Basic Linux Commands

Linux is an open-source operating system used for operating on a Linux VPS. It is a popular operating system for supercomputers and is used in mainframes, mobile computers, personal computers, and cloud computing. It has popular distributions like Ubuntu, Fedora, and SUSE Linux Enterprise Server. This article provides a summary of the common Linux commands, like the cd command for navigating through directories, the cat command for listing contents of a file, the mv command for moving and renaming files, rmdir command for deleting empty directories, the touch command for changing file timestamps, find command for searching files, sudo command for performing tasks with administrative permissions, and du command for displaying disk usage information.

Basic Linux Commands

Linux is an operating system like Windows, Android, Apple MAC, etc for operating on a Linux VPS. It is an open-source operating system. The operating system works more like the human brain. It processes the various commands and interacts with the computer's various hardware and software resources to provide desired results. The kernel in the operating system enables safe access to the hardware of the computer. Linux is multilingual and has a monolithic kernel, which defines a high-level virtual interface Called VPS. This operating system is a most sought one for supercomputer globally and is also utilized in mainframe computers, mobile computers, personal computers, cloud computing, etc. It is available on platforms like Unicore32, Alpha, ARM, Microblaze, MIPS, OpenRISC, Xtensa, SPARC.

About Linux OS

Established in 1991, this operating system has popular distributions like Ubuntu, Fedora, and SUSE Linux Enterprise Server. It also has various applications running in other operating systems, like Skype, Dota 2, etc. A major chunk of cloud infrastructure is powered by Linux and a large percentage of smartphones too.

With the rise in technological developments, the users have had to understand the operating system's basic commands to troubleshoot bugs and solve minor problems independently. These commands can also be used to organize and optimize applications. The common difficulty that occurs is not functioning of the remote host software despite it working locally. It can be solved by applying a few commands. Following are the few basic Linux commands that can come in handy for anyone who wishes to troubleshoot on their own:

?cd command

This command is used to navigate through the directory files; if you are in a particular location and want to search your file, type cd followed by the file name to open the file. Example: if you are in documents and want to search books file, type cd books. You can also switch to the previous directory by entering cd-, to one directory up by entering cd.., to go to the home folder by entering cd.

?cat command

This command is used for listing the contents in a file. This function is enabled by entering the cat, followed by the file name and extension of the file. Entering a cat followed by a filename creates a file. It is used to arrange the contents in the file in the upper or lower case by entering the cat, followed by file name followed by tr a-z A-Z > output.txt.

?mv command

This command is used for moving and renaming files. To move a file, enter mv, followed by the file's name and the file's location. To rename the file, enter mv, followed by the previous file name. Ext and new filename.ext.

?rmdir command

This command is used to delete empty directories. So if there is an empty folder or section on your computer, you can delete it by entering this command.

?touch command

This command is primarily used to change file timestamps. If the name of the file provided doesn't exist, it creates a new file in the Linux command line. To create a new file in the Linux command line, enter the touch file name. To create multiple files, enter as many filenames as you want to create. To change the access time, enter touch-a. To check if a file is created or not, enter touch-c.

?find command

It is used to find files in a particular directory. To search for a file, enter find/Home/filename and extension. The command will enable search of the entered file name. If the file to be searched is in the current directory you are using, then enter find. The file name with extension.

?sudo command

It is the superuser do command that enables you to perform tasks with administrative or root permissions. This command is sparsely used daily.

?du command

The du command stands for disk utility. This command lets you know the disk space occupied by the file in block numbers. If the -h argument is added along with, it will show the file size in bytes.

?tail command

The tail command displays the last ten lines of a file name. Enter the tail, followed by the file name and the extension, to view the file's last ten lines.

?tar command

The tar command is used to archive files in a zip file. This involves adding new files in a pre-existing archive, listing the archive's contents, extracting the archive content, etc.

?chown command

This command is used to change the ownership of a file. The ownership enables the special user functions confined to the owner of the file. To change the ownership, enter shown followed by the new owner's name followed by file name and extension, the entered file name owner will be changed.

?kill command

This command is used to remove the program that you don't want in your directory. To make this command function, you need to know the process identification number and the signal option. To kill the program immediately without saving the unsaved files, then the signal used is SIGKILL. To terminate the program after competition of its saving process, the signal SIGTERM is used. To execute the kill command, enter kill followed by the signal name in brackets followed by the identification number. If you are not aware of the process identification number, enter ps UX.

?wget command

The wget command is used to download files from the net. To download the desired file, type wget followed by the file name.

?top command

The top command displays the running files, programs, and the space they are consuming. Accordingly, you can close the unused files depending on the resources they consume.

?man command

This command is a user manual for all the other commands. Entering and command, followed by any other command of which you want to know the function, gives you the summary of the entered command's function.

?zip and unzip command

The zip and unzip command of Linux works very similar to the ones in the other operating systems. The zip command archives the files after compression, and the unzip command is used to uncompress the zipped files.

?useradd and userdel command

Linux enables many users to access it simultaneously, but the access to the system should be provided. The useradd command is used to add a new user to the system. By using the PWD command, the password can be created for the new user's account. The new user can be added by simply entering the useradd, followed by the new username. The userdel command is used to delete users from the system. Enter the userdel, followed by the name of the user you want to delete from the system.

?clear command

The clear command is used to clear the terminal if it's unused and junk files.

?PWD command

This command works much like the address to your home. It is used to find the path of the current directory you are working on. The path includes the whole fictions divided by a forward slash.

?ls command

The la command is used to obtain the contents of the directory. Upon entering the ls command, it shows the contents of the current directory you are working on. The path of the desired directory preceded by the ls command will show the contents of that directory. The other functions of the ls command are ls-a to find the hidden files, ls-R to find the list of files in subdirectories, and ls-al will display files in the subdirectory.

?cp command

This command is used to copy files from one directory to the other. If you want to copy a recipe book to the books folder, enter cp recipe book.txt followed by home/username/books. The recipe book will be copied into the books folder.

?rm command

The rm command is used to delete the directory as well as the contents inside the directory. This command has a drawback though, the directories get deleted permanently on the command's execution and cannot be retrieved. So care should be taken that the content to be deleted will no longer be required.

?mkdir command

The mkdir stands to make a new directory. This command is used to create a new directory by just entering mkdir, followed by the directory name. To create a subdirectory inside a directory, enter mkdir followed by directory name and the subdirectory name. This command can also create a new directory between the two existing directories by adding the -p command.

?grep command

It is the search option of Linux. This command is used to search for a particular word or phrase in the file. The searched word will appear along with the whole sentence it is present in. For example, to search flower in the file, enter grep flower, and the whole sentence where the flower is present.

?locate command

This command is used to find the file you are searching for. The most interesting service by this command is finding the file despite not knowing the exact full name of the file by just adding -I argue to it. If two or more words are present in a file name, then the two words should be separated by an asterisk sign.

?curl command

The curl command is used to transfer the URL. The command can be used to check the functioning of your created URL in the working system and the remote system database. It helps in identifying the errors which can be troubleshot to enable functioning.

?head command

This command is used to view the first lines of a file. Upon entering the command, it displays the first ten lines of the desired file. The number of lines to be viewed can be changed by entering it in the command along. For example, to view the first eight lines of the file book, enter the head -n8 book.ext.

?df command

This command enables the user to know about the disk occupancy and space available. If you want the quantity to be viewed in bytes, enter -b along with the df command.

?chmod command

Linux is a multiuser system, and every user has certain permission for access. The chmod command is used to change the read, write or execute permissions for a file.

?diff command

This command is used to find the differences in the contents of any two files. This command functions by comparing individual lines of the file and pointing out the difference. This is a commonly used command among coders and programmers to create files with just small differences, this saving up the time of whole creation again.

?jobs command

The job command is used to display the status of jobs within the shell.

?ping command

The ping command is used to check the connectivity with the browser. It also displays the connection time. For example, to check the connectivity with yahoo, enter ping The command will display the connectivity details with yahoo.

?unnamed command

The unname command stands for Unix name. By entering this command, the Linux system details like the operating system, machine name, remote access name, kernel, etc. Will be displayed.

?history command

This command is like the taskbar for commands. By entering this command, the previously entered commands can be accessed. This command can be used to check if there is an error in a previously entered command or repeat the command.

?echo command

The echo command is used to add text to a file. To enter text in a file, enter echo followed by the sentence or text you want to enter, followed by >>the file name you want the text to display.

?hostname command

This command is used to identify the host of the network. To enable the command, just enter the hostname. To access the host's IP address, add the argument -I at the end of the command.

Though there are many more commands through which Linux functions can be executed, these are a few basics that can come in handy for basic access and modifications for users.