Linux Commands

1. pwd (print working directory): The pwd command is a command-line utility for printing the current working directory. It will print the full system path of the current working directory to standard output.
2. mkdir: mkdir command allows the user to create directories (also referred to as folders in some operating systems).
Syntax : mkdir foldername
3. ls: It is one of the basic commands used in Linux. It is used to list information about files and directories within the file system.
Syntax: ls folder_name
4. cd (change directory ): The cd command also known as chdir is a command-line shell command used to change the current working directory in various operating systems. Syntax: cd folder_name
To go to the parent directory:
Syntax: cd ..
5. touch: The touch command is a standard command used in the Linux operating system which is used to create, change and modify timestamps of a file. The file created using the touch command is empty.
Syntax: touch filename.txt
6. cat (concatenate): The cat command is one of the most frequently used commands in Linux/Unix-like operating systems. cat command allows us to create single or multiple files, view contain files, concatenate files, and redirect output in terminal or files.
a. To display contents of the file
Syntax: cat filename.txt
b. To create a file using the cat command
Syntax : cat > filename.txt
c. To append the contents of the file
Syntax : cat >> filename.txt
d. To display contents of 2 or more files together
Syntax: cat file1name.txt file2name.txt
7. gedit: gedit is a powerful general-purpose text editor. It can be used to create and edit all kinds of text files.
8. mv : mv stands for move. mv is used to move one or more files or directories from one place to another in a file system like UNIX. It has two distinct functions:
(i) It renames a file or folder.
Syntax: mv filename.txt newfilename.txt
(ii) It moves a group of files to a different directory.
Syntax: mv filename.txt foldername.txt
No additional space is consumed on a disk during renaming. This command normally works silently means no prompt for confirmation.
9. grep: The grep filter searches a file for a particular pattern of characters, and displays all lines that contain that pattern. The pattern that is searched in the file is referred to as the regular expression (grep stands for Globally search for Regular Expression and print out).
Syntax: grep word filename.txt
But if we don’t know the file name
Syntax : grep word *.txt
10. rmdir: rmdir command is used to remove empty directories from the filesystem in Linux. The rmdir command removes every directory specified in the command line only if these directories are empty. So if the specified directory has some directories or files in it then this cannot be removed by rmdir command.
Syntax : rmdir foldername
11. rm: rm stands for remove here. The rm command is used to remove objects such as files, directories, symbolic links, and so on from the file system like Linux. To be more precise, rm removes references to objects from the filesystem, where those objects might have had multiple references (for example, a file with two different names). By default, it does not remove directories.
Syntax: rm filename
12. man: man command in Linux is used to display the user manual of any command that we can run on the terminal. It provides a detailed view of the command.
Syntax : man commandname
13. date: date command is used to display the system date and time. date command is also used to set the date and time of the system. By default, the date command displays the date in the time zone on which Unix/Linux operating system is configured.
14. free: In Linux systems, you can use this command to get a detailed report on the system's memory usage.
15. echo: echo command in Linux is used to display lines of text/string that are passed as an argument. This is a built-in command that is mostly used in shell scripts and batch files to output status text to the screen or a file.
16. clear: The clear command is used to remove all previous commands and output from consoles and terminal windows in Unix-like operating systems.
17. exit: exit command in Linux is used to exit the shell where it is currently running. It takes one more parameter as [N] and exits the shell with a return of status N. If n is not provided, then it simply returns the status of the last command that is executed.