Terminal Commands

On modern Linux systems knowing terminal commands isn't as necessary as it once was, however I think it is still a faster and sometimes easier way of interacting with your system. We will start with the must knows and move down the list to the more complicated but still useful to know.

It should be noted that you should be able to use the "man" command followed by any of these commands to view their manuals for more information.

Must Know Commands

cd

"cd" Changes the current working directory.

ls

"ls" Lists the current directory, there are ways to modify this command to show more information. My favourite way of using this command is actually an alias of "ls -l" called "ll" this will list the directory in an actual list showing you more detailed information than the "ls" command does. For both you can add the "-a" argument to list hidden files.

tree

"tree" Displays a tree like list of the current directory, When using this you can specify the directory or just navigate to the directory and use it from there, also adding "-C" will colourise the results and the "-a" argument will show hidden files.

mkdir

"mkdir" Makes a new directory, this can be as simple as making a new folder or if you give it a completely new path and use the "-p" (parent) argument it will make it.

rmdir

"rmdir" Deletes an empty directory. The "-p" argument must be used to remove a path.

touch

The "touch" command creates files, by default they are empty documents however you can specify a file type and can create multiple in the same command.

rm

"rm" Deletes a file, as with touch you can list multiple in one command. This is a dangerous command as files removed via this command are permanently gone and there is no confirmation to hit to say you are sure you want to remove the file. Be careful with this command.

cp

"cp" Copies files and directories, to another location. You can also rename the file while copying it.


mv

"mv" Moves or renames files and directories.

pwd

"pwd" Prints the current working directory.

fd

"fd" Finds files and directories.

clear

"clear" Will clear the terminal so that is will appear clean and new.

Useful Commands

wc

"wc" Counts the number of words, lines, characters and bytes in a file.

ln

"ln" Creates symbolic links with the "-s" argument (shortcuts) and hard links (a copy/mirror of the original file).

ln -s /path/to/file_or_directory path/to/symlink

cat

"cat" Displays the contents of a given file in the terminal in a read only view.

bg & fg

"bg" Will put any suspended process in the background, "fg" will bring the background process to the foreground.

df

"df" Gives an overview of the file system disk space usage, using the "-h" argument will make it human readable. The command bellow will make it only display only the useful parts.

df -h -x squashfs -x tmpfs

wget

"wget" Allows you to download files from the internet. Specifically from HTTP, HTTPS and FTP servers.

wget http://somesite.com/somefile.php

curl

"curl" Also allows you to download files from the internet but is so much more than I will discuss here as it is a very powerful tool, you will most probably use it when downloading applications. It supports a wide plethora of server protocols.

In Conclusion

There are many more useful commands out there and you will learn them over time as and when you need them, the important thing is to not try and learn everything at once as that will be overwhelming and you are less likely to remember them all that way.