3 Text Formatting Tricks: remove duplicate lines, remove empty lines, convert upper cases to lowers

In this article I will show you 3 basic text formatting tricks. It is very usefull to know how to manipulate text files. Remove repeated lines in a file: I have this file: $ cat textfile sample line1 sample line1

Find Trick: How to find and delete the empty directories in a directory tree

In this article I will show you how to delete the empty directories from a directory tree with the find command. I will use the find command, combined with rmdir. The rmdir command deletes only the empty directories and doesn’t

File extensions in Linux and Unix

On Unix and Linux systems, the file extensions are a matter of convention. They are used to help the user choose a program to read/open the file. A few extension conventions: Usually, the regular files have extensions: file.txt, file.pdf. The

How to cd into a directory only by typing the directory name

In this article I will show you how to cd into a directory by only typing the directory name. To do this, you have to activate the autocd. For bash: shopt -s autocd $ ls -ld naboo drwxrwxr-x 2 razvan

How to change the umask in Linux and Unix

The umask is used for setting up the default permissions in Linux and Unix. The default umask valus is 0022. The umask representation is diffrent than the chmod octal represetantion. I will explain you why. The default permission of the

How to set the SetUID and SetGID bit for files in Linux and Unix

The setuid (set user id) is a permission bit, that allows the users to exec a program with the permissions of its owner. The setgid (set group id) is a bit that allows the user to exec a program with

How to use the sticky bit in Linux and Unix

The sticky bit is set on directories to forbid all the users in the system to rename or delete the directory or the files/directories inside the directory, except the owner and root, even if they have 777 permissions. To set

How to change file and folders permissions with chmod – part 2

Previously, I have showed you how to change the file and folder access rights, by using the symbolic method. In this article I will show you how to change the file permissions in the octal mode (with numbers). The chmod

How to replace one string with another in a file

In this short article I will show you how to replace a string with another, globally, everywhere it is found. I needed this to replace one extension with another: $ rename ‘-s/\.JPG$/.jpg/’ * This little oneliner looks in all the

How to change file and folder permissions with chmod – part 1

Permissions can be set in the octal mode (with digits), or with letters. In this article, we will change the file and folder access rights in the human readable representation with chmod. In Linux and Unix systems, the file and

Support LinuxG via Patreon
Support LinuxG.net on Patreon!
Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!