29 Linux commands that you must know
Although the Linux release supports a variety of graphical user interfaces, in some cases, the Linux command line interface (bash) isSimple and fast. Bash and Linux Shell are called command line interfaces.
Commands are commands used by computers to execute tasks. You can use commands to shut down the computer, or list the file list of the current directory, or the content of the current text, or display a message on the screen.
If you are a newbie and try to use the command line interface, we collect various basic Linux commands for you to learn and help you complete various tasks in various Linux distributions. Although not very detailed, it is very useful for Linux beginners, General fire, or administrators.
1. ls-List
ls
The contents of the current working directory (file or folder) will be listed, just like opening a folder in the GUI to see the content in it.
2. mkdir-Make Directory
mkdir <new-directory-name>
A common new directory
3. pwd-Print Working Directory
pwd
Display current working directory
4. cd-Change Directory
For the session currently running on the terminal,cd <directory>
Set the Given folder (or directory) to the current working directory.
5. rmdir-Remove Directory
rmdir <directory-name>
Delete the specified directory.
6. rm-Remove
rm <file-name>
Will delete the given file or folder, you can userm -r <directory-name>
Recursively delete folders
7. cp-Copy
cp <source-file> <destination-file>
Command to copy files or folders. You can usecp -r <source-folder> <destination-folder>
Options to recursively copy folders.
8. mv-MoVe
mv <source> <destination>
Command to move a file or folder. If the file or folder exists in the current working directory, you can also rename the file or folder.
9. cat-concatenate and print files
cat <file>
Used to View File Content on standard output (monitor or screen.
10. tail-print TAIL (from last)>
tail <file-name>
By default, the last 10 lines of content of a given file are displayed on the standard output.tail -n N <file-name>
Specifies the last N lines of the file to be displayed on the standard output.
11. less-print LESS
less <file-name>
Print the file content by page or by window. It is very useful and efficient in viewing large files containing large amounts of text data. You can useCtrl + FFlip forward,Ctrl + BFlip back.
12. grep
grep "<string>" <file-name>
Search for the specified string in the specified file.grep -i "<string>" <file-name>
The case sensitivity of the string is ignored during search, whilegrep -r "<string>" <file-name>
The specified string is recursively searched in the current working directory file.
13. Find
This command searches for files matching the conditions at a given location. You can usefind <folder-to-search> -name <file-name>
Of-name
Options for case-sensitive searches,find <folder-to-search> -iname <file-name>
To perform case-insensitive searches.
find <folder-to-search> -iname <file-name>
14. tar
tar
Command to create, view, and extract tar compressed files.tar -cvf <archive-name.tar> <file1-OR-file2-OR-both-to-archive>
Is to create the corresponding compressed file,tar -tvf <archive-to-view.tar>
To view the corresponding compressed file,tar -xvf <archive-to-extract.tar>
To extract the corresponding compressed file.
15. gzip
gzip <filename>
Command to create and extract gzip compressed files, you can also usegzip -d <filename>
To extract compressed files.
16. unzip
unzip <archive-to-extract.zip>
Decompress the gzip file. Before decompression, you can useunzip -l <archive-to-extract.zip>
Command to view the file content.
17. help
<command-name> --help
All available commands are listed on the terminal.-h
Or-help
To view the specific usage of the command.
18. whatis-What is this command
whatis <command-name>
A single line is used to describe the given command.
19. man-Manual
man <command-name>
A manual page is displayed for the given command.
20. exit
exit
Ends the current terminal session.
21. ping
ping <remote-host-address>
Ping the remote host (server) by sending data packets to detect network connections and server status.
22. who-Who Is logged in
who
Lists the usernames currently logged on.
23. su-Switch User
su <username>
Used to switch between different users. Super Users can switch to other users even if they do not use a password.
24. uname
uname
Displays important information about the system, such as the kernel name, host name, kernel version, and processor type.uname -a
You can view all information.
25. free-Free memory
free
The system's idle memory, occupied memory, and available swap memory are displayed,free -m
Converts the unit in the result to KB, whilefree –g
Convert to GB.
26. df-Disk space Free
df
View disk usage in the file system-used and available storage space of the hard disk and other storage devices. You can usedf -h
Display the results in a human readable manner.
27. ps-ProcesseS
ps
Displays the running processes of the system.
28. Top-TOP processes
top
By default, the command displays processes that occupy a large amount of resources based on CPU usage.top -u <username>
View the CPU usage ranking of a user.
29. shutdown
shutdown
Used to shut down the computer, whileshutdown -r
Used to restart the computer.
Related Articles
9 Linux Commands & Codes to be Wary
Practical linux commands (1)
Practical Linux commands (2)
Http://www.ido321.com/1609.html.