Linux Basics

This post outlines a couple of commonly used Linux commands.

man - command used to display manual pages for specific commands (e.g., “man ls”). Man pages are your friend!

ls - similar to the DOS dir command. It lists directory contents. Try “ls -al” for a detailed directory listing.

cd - change directory. “cd ~” will take you to your home directory.

rm - used for deleting files and folders. Similar to the DOS del command.

mv - move or rename a file

cp - copy a file

ps - shows running processes. “ps aux” shows a good amount of info.

startx - Starts X windows if run from the system console (assuming it is configured).

pwd - displays your “present working directory” or current directory.

exit - closes a shell session or logs you out of the console.

./file - executes the file located in the current directory. The current directory is represented by “./”. This is useful when you want to execute a command or script that isn’t located within the system path.

shutdown -r now - reboot the system NOW.

shutdown -h now - halt the system NOW.

vi - starts up a popular but not very user-friendly editor. vi is a very powerful editor but it takes a little getting used to.

df - shows free disk space on all volumes

free - shows free memory. Use the “-m” parameter to show memory in MB.

du - shows directory usage in terms of space for current directory and all subdirectories.

top - shows system processes. Hit “q” to exit.

uptime - shows uptime and system load statistics

cat - concatenate files and print on the standard output. To display a text file on the screen, type “cat filename”

There are many more commands; too many to cover here. However, the commands listed above should be enough to allow you to navigate around a linux system.

A couple more notes:
- “.” represents the current directory.
- “..” represents the parent directory (e.g., “cd ../images” will change directory into the images folder in the parent directory).
- “~” represents your home directory (e.g., /home/jsmith). The “~” can be used in path representations such as “cd ~/public_html” which is the same as typing “cd /home/jsmith/public_html”.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)