Linux is a very popular open source operating system – computer geeks prefer this OS over other mainstream operating systems as there’s more room to play in Linux. Even though the modern versions of Linux offers easy to use GUI based interfaces, still many features are easy to avail through the command line based interface. Popular Linux shells like Bash allows the users to complete their task through a written command. Such written commands could be used for most Linux commands from copying a text file to shutting down the computer.
Newbies may not know the mostly used and powerful commands in Linux; hence here’s an assortment of 25 that every Linux user should know.
- ls – List
To get the list of files and folders in a directory, this command needs to be used. This is almost identical to ‘dir’ command used in command prompt, Microsoft Windows. This offers the same feature as opening a folder in the graphical file explorer to see the contents inside that folder; only it is in command window.
- mkdir – To create a directory
To create a new file or directory inside an existing directory, mkdir command is used. However, the same operation may be carried out using the new/create directory option available in the Context Menu. Also, creating a new directory inside GUI file explorer does the same job.
- pwd – Print Working Directory
An easier way to print the file or directory user is currently working on. This reduces the workaround in Linux settings and gets the job done faster than the available GUI methods. The command simply needs to be typed in and the print operation is carried out.
- cd – Change Directory
This command makes the terminal like Bash or anything else make the opened folder or directory as the current working directory. A directory or folder should already be opened earlier in order to define the current working directory. However, this works similar as the graphical UI based file explorer.
- rmdir – Remove Directory
Not just creating directories but also deletion of directories is an important part in any computing ecosystem. rmdir command works with the desired feature, it removes a folder or directory from an already existing directory. Likewise, the directory may be kept open initially.
- rm – Remove
Remove – rm is used to remove various directories from their initial locations. There maybe two ways to define a specific Remove command. The formats are – rm <file name> and rm –r <directory-name>. It depends on whether you are trying to open a file or a folder.
- cp – Copy
As the title itself goes – cp command copies between a source and a directory. The structure of the command is cp <source><destination>. Alternately, cp –r <source-folder><destionation-folder> may also be used for directories.
- mv – Move
Move command performs moves the file from one directory to another without leaving behind any trace at all. This command works like the cut option in Windows OS. In case the source destination already has the same name, it could rename the destination file as well.
- cat – Concatenate files, and Print
The printout would be projected on the output device e.g. monitor in standard cases. The operation is similar to opening files in the GUI.
- tail – Print TAIL, Last ones First
TAIL command is used to print 10 lines from the last in any file or directory. Number of lines is set to 10 by default on this following command, however the tail –n N <file name> command modifies the output number to N.
- less – Fit Contents on Display
To see more contents fitted into one page or window, the less command is typically used. Ctrl+F makes the documents next page shows up whereas Ctrl+B shows the previous page or window.
- grep – Search String
The grep command is used to specifically search for a string in an opened file or directory. Grep-“<string>” <file-name> makes the search more defined and streamlined to a specific string lying within a specific file. Also, the inclusion of an –i makes the search case insensitive.
The command name itself is self-explanatory. When this command is initiated, the command looks for a specific file lying inside a specific folder. The command structure is as following find <search-folder> -name <file-search>.
- tar – Extract Archives
Tar is a compressed file format and this command is used to extract tar files. Format: tar –cvf <archive-name.tar>.
gzip command is used to extract gzip files. The command format looks like gzip –d <name of file>.
Unzipping files in Linux isn’t as easy as using WinZip. However, unzip –I <extractable-archive.zip> is the command.
To get all the available command list in the command based interface, the help command can help. –h or –help is the format for typing in this command.
- whatis – Command Description
This command shows the description for given command. If a user isn’t sure about what a command means then whatis <command> could help them know about it.
- man – Manual
Each command may be assigned to a manual page with information and usage protocols, man command helps them get the detailed manual page using man <command> format.
To exit one open terminal, this command should be used. However, on a GUI based window the user can also click the X button to close; both are similar.
- who – Logged-in Users
To know which users are currently logged into a Linux system, the ‘who’ command is used.
To ping a network host using Linux terminal, ping <host> command should be used.
To switch between logged-in users, su command is typically used even though GUI offers easier solution to this. Su may achieve login even without a password.
This command is used to free up memory in the system Linux is running on. Free-m shows the amount of free-able memory.
This command shows the running processes in a Linux system.
The command line based system is based on plenty more of commands, but these 25 are basic and mostly used for basic operation.