Linux Commands (BASH)

BASH command line list for Linux/Unix.

(A-C), (D-H), (I-P)

man – I felt that this would be an appropriate spot to reference this informative Linux tool. man is short for manual. While I provide a simple guide to bash commands,’man’ will provide a more in depth description of the features each command offers i.e. tags, syntax, and uses. Use it often. You will find great features and tags to use.
syntax: man <command>


alias – Creates an alias. This is a very helpful command. You can store aliases in your ~/.bash_alias or ~/.bashrc files. When you load your terminal, these aliases will load as well. Example:

If you add the following line in one of the aforementioned .bash files and restart your terminal:

alias docs=’cd ~/Documents’

When you type docs in the terminal and hit enter, you will be taken to your Documents directory. This is helpful for starting programs that are not included in your /etc/inti.d directory for auto boot on startup. Here is an example of a command line where the program file is locate in a long winded directory:

alias sqldev=’~/Applications/SQL_Developer/opt/sqldeveloper/sqldeveloper/bin/sqldeveloper’

Once created, I only need to type sqldev to begin the program.

apt-get – Search for and/or install software packages (Debian/Ubuntu)

aptitude – Search for and/or install software packages (Debian/Ubuntu) These two will come in handy when you need to install or remove program packages.

awk – Find and Replace text, database sort/validate/index. This is a very powerful tool. It allows you to find patterns in text files and process language in bash scripts. This is a bit more advanced, but when used properly it can save you a lot of time. Here is a very good reference to learn more: NixCraft
syntax: awk ‘/<string>/’ <filename> this will print each line that contains the string in the file name provided.

**NOTE** awk is way more powerful than the syntax example I provided. I will include this in an advanced Linux command section.


bg – This is better explained with ^z. It sends the current process to the background. This is helpful when working remotely. This way you won’t need to open a new terminal and connection.


cal – Display a calendar. More than likely you will never use this.

case – This is used in scripts. Conditionally perform a command on a case by case scenario.

cat – cat is very powerful, especially when used in conjunction with grep or other bash commands. It will print (display in the terminal) the content of files.
syntax: cat <filename>

cd – Change Directory. This will be used often.
syntax: cd <directory>

chmod – This command will be used every so often .Change access permissions to files and directories. It will be important to familiarize yourself with the permission settings.
syntax: chmod 777 <filename> or chmod 777 -R <directory> -R – This is a good time to mention this recursive tag. When in place it will recursively go through the contents of the folder and its sub-directories, files included and set permissions to all therein.

Permission settings:

  • r = 4 (read)
  • w = 2 (write)
  • x = 1 (execute)

So if you wanted to give the owner full permissions, the group read/write and all users just read permissions you would execute the following: chmod 761 <filename>

chown – Change file and directory owner and group. This works in a similar fashion to chmod.
syntax: chown <username> <filename> or chown <username>.<groupname> <filename> or chown <username> -R <directory> or chown <username>.<groupname> -R <dir.>

chroot Run a command with a different root directory

clear – Clears terminal screen. You can still scroll up to see previous commands and output. It may be a good idea to go into your terminal profile and set the maximum memory to infinite or greater than the default.

cp – Copies one or more files from one location to another or within the same as long as a different file name for the copy is provided.

cron – Daemon to execute scheduled commands or scripts. Very powerful. I will create a “How-to” post in this daemon.

crontab – Used to schedule a command or script to run at a specified time interval (used to schedule a cron job)

csplit – Split a file into context-determined pieces. One way to use this is to specify a line number where you would like the split to take place.
syntax: csplit <filename> <line #>

cut – Divide a file into several parts. This is a great tool for removing characters or displaying text managed by delimiters.
syntax: cut -c 1 <filename> This will display the first character of each row in the specified file. I may do a “How-to” on this one as well, since it offers a lot.
This site provides a good reference: Linux.101Hacks

Leave a Reply

Your email address will not be published. Required fields are marked *