Simple Linux commands

Reading Time: 3 minutes

These are a list of the most commonly used linux commands

CommandDescription
lsIt is a list command and will display the directories and files visible under the present working directory
ls -RGoes a step further to display or list files in sub-directories of the present working directory
ls -aThe argument -a in this list command helps list all the hidden files in the present working directory
ls -alThe argument -al in this list command gives a detailed list of the displayed files and directories with extra information such as size, permission, owner, etc.
cd or cd ~Takes you to the Home directory of your Linux operating system
cd ..navigates you backwards to the parent directory of the current directory you are under.
cdcombine it with a target directory under the present working directory to navigate to it e.g cd Downloads
cd /Takes you to the root directory of your Linux operating system
cat > filenameIt will create a file called filename
cat filenameIt will display the contents of a file called filename
cat file_1 file_2 > file_3Joins the content of file_1 and file_2 and copies the result to a newly created file_3
mv file_random “defined file path”It will move the file called file_random to the target file path or destination you will define.
mv file_name new_filenameIt will rename the file called file_name to a new file name called new_filename
sudoA command used by sudoer users to execute privileged commands applicable to a root user or superuser.
rm filenameIt will delete a file called filename
manUse it with a Linux command you do not understand to get help on how to use it. E.g man sudo
historyIt will display a list of the previous Linux terminal commands you have executed under that specific session.
clearIt will clear your command-line interface if you feel it is too crowded.
mkdir directory_nameit will create a director called directory_name
rmdir my_directoryIt will delete a directory called my_directory
mvYou can use it to rename a directory or a file
pr -xIt will divide or split a file to x defined columns.
pr -hUse it to add a header to a target file.
pr -nUses Line numbers to denote a target user file.
lp -nc, lpr cIt is a printing function and in this case it will print c copies of a target file.
lp -d lp -PHelps you identify the name of the printer you are using.
apt or apt-getA Debian distro package command for installing system updates and package applications
mail -s ‘mail_subject’ -c ‘cc-mail_address’ -b ‘bcc-mail_address’ ‘to-mail_address’Use this command to send an email from the terminal.
mail -s “mail_subject” to-mail_address < attachment_filenameUse this command to also send an email from the terminal but this time with an attachment.

Leave a comment