In this tutorial, we will show you learn basic Linux commands system. For those of you who didn’t know, A basic understanding of the Linux command line environment (also commonly known as the “shell” or the “terminal”) is important if you ever need to set up a special configuration, install an application manually, or you just want to have a better understanding of how your web site works. The command line gives you more power over your system and access to features that are not available through a graphical interface.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges.
- A server running one of the following operating systems: Ubuntu or any other Debian-based and RHEL-based.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Basic Linux Commands
|cat [filename]||Display the file’s contents to the standard output device|
(usually your monitor).
|cd /directorypath||Change to the directory.|
|chmod [options] mode filename||Change a file’s permissions.|
|chown [options] filename||Change who owns a file.|
|clear||Clear a command-line screen/window for a fresh start.|
|cp [options] source destination||Copy files and directories.|
|date [options]||Display or set the system date and time.|
|df [options]||The display used and available disk space.|
|du [options]||Show how much space each file takes up.|
|file [options] filename||Determine what type of data is within a file.|
|find [pathname] [expression]||Search for files matching a provided pattern.|
|grep [options] pattern [filesname]||Search files or output for a particular pattern.|
|kill [options] pid||Stop a process. If the process refuses to stop, use kill -9 pid.|
|less [options] [filename]||View the contents of a file one page at a time.|
|ln [options] source [destination]||Create a shortcut.|
|locate filename||Search a copy of your filesystem for the specified|
|lpr [options]||Send a print job.|
|ls [options]||List directory contents.|
|man [command]||Display the help information for the specified command.|
|mkdir [options] directory||Create a new directory.|
|mv [options] source destination||Rename or move the file(s) or directories.|
|passwd [name [password]]||Change the password or allow (the system administrator) to|
change any password.
|ps [options]||Display a snapshot of the currently running processes.|
|pwd||Display the pathname for the current directory.|
|rm [options] directory||Remove (delete) file(s) and/or directories.|
|rmdir [options] directory||Delete empty directories.|
|ssh [options] user@machine||Remotely log in to another Linux machine, over the network.|
Leave an ssh session by typing exit.
|su [options] [user [arguments]]||Switch to another user account.|
|tail [options] [filename]||Display the last n lines of a file (the default is|
|tar [options] filename||Store and extract files from a tarfile (.tar) or tarball (.tar.gz or .tgz).|
|top||Displays the resources being used on your system. Press q to|
|touch filename||Create an empty file with the specified name.|
|who [options]||Display who is logged on.|
Congratulations! You have successfully learned basic commands for Linux. Basic Linux commands help users execute tasks easily and effectively. It might take a while to remember some of the basic commands, but nothing is impossible with lots of practice. In the end, knowing and mastering these basic Linux commands will be undoubtedly beneficial for you.