Linux Command Line Cheat Sheet
There are a multitude of commands available within the Linux operating system and they only increase with the more software you install on your VPS or server.
However, some commands are almost universal from one Linux distribution to the next. They include commands that provide an overview of system heath and files system navigation. This guide will provide a concise cheat sheet detailing the most command administrative commands you will find on 99.99% of all Linux installations. |
The following commands will give you a very quick and detailed overview of your current Linux system state:
- free - displays an overview of the system RAM and swap space, such how much is currently used and available.
- top - a real time CLI displaying overall system and process resource utilisation.
- uptime - a one-time shot of how long the system has been up and what the current Linux load averages are.
- df - stands for 'disk free'. Gives and overview of how much disk space is free for mounted media. Can also provide details of inode usage, etc.
- pwd - stands for 'print working directory'. This command will display the path to the directory you are currently working in.
- cd - stands for 'change directory'. Used to change the current working directory.
- cd .. will move you up one directory level
- cd or cd ~ on its own will change directory to the current users home directory
- cd [path] will change directory to the specified path
- ls - lists the current directory contents.
- ls on its own will list the file and directory contents of the current working directory.
- ls [path to directory] will list the file and directory contents of the specified directory.
- ls -lah will list all the contents of the current directory as a list in human readable format. The -l option means show as a 'list', the -a option means show 'all' content (even hidden files) and the -h option tell ls to show the results in human readable format (file sizes in megabytes, gigabytes, etc. instead of bytes).
- mkdir - stands for 'make directory'. Used to create a new directory.
- mkdir [path to directory] creates a new directory on the given path.
- mkdir -p [path to directory] creates a new directory on the given path and also generates any directories along the path that are not yet created. The -p option mean 'parents'.
- mv - stands for 'move'. Used to move files and directories to alternative locations within the mounted files systems.
- mv [path to source file or directory] [path to new directory location] will move a file or directory to another directory location.
- mv [path to source file or directory] [path to new file or directory name] will rename a file or directory.
- rm - remove the specified file or directory
- rm [path to file] will remove a file
- rm -r [path to directory] will remove the specified directory and all sub directories and files. The -r option means 'recursive'
- touch - changes a files time stamp and creates a file in the file does not exist