Linux is the home to open-source Unix operating systems based on the Linux Kernel. They include Ubuntu, Fedora, Debian, OpenSUSE, and Red Hat. Using Linux to manage a Virtual Private Server (VPS) is common practice.
What do you mean by Linux Commands?
A Linux command is a program that runs on the CLI(a console that interacts with the system via texts and processes). It’s similar to the Command Prompt application in Windows.
Linux commands are executed on a Linux terminal by pressing Enter at the end of the command, we can run the commands to perform various tasks.
Syntax: CommandName [option(s)] [parameter(s)]
Here, we are listing some basic Linux commands:
Commands | Uses |
---|---|
1. sudo command | This command performs tasks that require administrative or root permissions. |
2. pwd command | This command is used for printing the current working directory. |
3. cd command | The cd command in Linux is known as the change directory command. |
4. ls command | The ls command is used to list files. “ls” on its own lists all files in the current directory except for hidden files. |
5. cat command | The cat command is used to create single or multiple files, view the content of a file, concatenate files and redirect output in the terminal or files. |
6. cp command | The cp command used for copying files from one location to another. |
7. mv command | The mv command moves files and directories from one directory to another or renames a file or directory. |
8. mkdir command | This mkdir command in Linux allows the user to create directories. This command can create multiple directories at once as well as set the permissions for the directories. type “mkdir <dir name> in the terminal, in place of <dir name> type the name of the new directory which you want to create and then press enter. |
9. rmdir command | The rmdir command is used to remove empty directories from the filesystem in Linux. |
10. rm command | For removing a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r. Directories that are removed with the rmdir command cannot be recovered, nor can directories and their contents be removed with the rm -r command. |
11. touch command | It is mainly used to create empty files, and change the timestamps of files or folders. Syntax: touch -a <filename> |
12. locate command | The locate command finds files in Linux using the file name. |
13. grep command | The Grep for “global regular expression print”, is a command used in searching and matching text files contained in the regular expressions. |
14. df command | The df command (short for disk free), is used to display information related to file systems about total space and available space. |
15. du command | The du command displays the number of blocks used for files. |
16. set –e | This option allows the terminal to throw an exception when it finds the error and then the code stop execution |
17. head command | As the name implies, the head command will output the first part of the file |
18. tail command | the tail command will print the last part of the file |
19. diff command | We know that diff stands for the difference. This command is used to display the differences in the files by comparing the files line by line. |
20. tar command | The tar command is used to compress a group of files into an archive. This command of Linux is also used to extract, maintain, or modify tar archives. Tar archives merge multiple files and/or directories together into a single file. Syntax: tar [options] [archive-file] [file or directory to be archived] |
21. chmod command | It refers to ‘change Mode’ and is used for changing a file’s mode to whatever mode you want to use |
22. chown command | it refers to ‘change owner’, which is used to change the file Owner or group. Whenever we want to change ownership we can use chown command. |
23. jobs command | This is a very useful command it is used to list out all jobs in the system (active, stopped, or otherwise) that are running in the background and in the foreground. |
24. kill command | kil is a shell bulletin for two reasons it allows job IDs to be used instead of process IDs and allows process to be killed if the limit on the process that you can create is reached. |
25. ping command | The ping command is a general utility that is used for checking whether any network is present or not and if a host is active or not. |
26. wget command | wget stands for ‘web get’. It is the non-interactive network downloader used for downloading files from the server even when the user has not logged on to the system and it can work in the background without interfering with the current process. |
27. uname command | Simply we can say it is used for displaying system information or Uname is a command-line tool in Linux-based operating systems that prints information about the kernel, system architecture, hardware, version, and other information, and more. |
28. top command | The top command is commonly used for displaying system-performance information. It dynamically shows administrators which processes are consuming processor and memory resources like the task manager of windows OS. |
29. history command | The history command is used to view the previously executed command. |
30. man command | The man command is a built-in manual for using Linux commands. It allows users to view the reference manuals of command runs in the terminal. The man page (which stands for the manual page) includes a command illustration, suitable options, flags, examples, and other informative sections. |
31. echo command | The echo command is used to display a line of text that is given in as an argument |
32. zip, unzip commands | The zip command is used to compress any file and folder (if you do want to compress any folder then you need to use -r for recursive zipping) Unzip command is the opposite of the zip command it is used to extract the file |
33. useradd, userdel commands | The useradd command is used to create new accounts in Linux. userdel command is used to delete the local accounts in Linux. |
34. alias, unalias commands | An alias is defined for each name whose value is given a trailing space in value causing the next word to be checked for a light substitution when the alias is expended |
35. su command | su refers to ‘switch user’. By using this command You are primarily switching to a particular user and also you need the password for the user you are switching to. |