In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the usage examples of 8 commonly used commands in Linux. The introduction in this article is very detailed and has certain reference value. Interested friends must read it!
1.cd
Man cd
Description: switch directories
Common parameters:
Directly use cd [directory]
Example:
Change to the bluseli directory
Cd / home/bluseli/
Cd. / home/bluseli/
Switch to the bluseli user directory
Cd ~ bluseli
Switch back to the user's home directory
Cd
Cd ~
Switch between folders and table to view the files under this folder twice.
Cd / home/ + twice table
Switch back to the root directory
Cd /
Switch to the previous directory
Cd..
Resume the last operation
Cd-
2.pwd
Man pwd
Pwd [- L |-P]
Description:
Displays the full path (absolute path) of the current directory
Common parameters:
-L
Show the path to the connection file
-P
Displays the path to which the connection file is connected
Example
Show current path
Pwd
There are no connection files in this folder, so the display is the same
Pwd-L |-P
3.ls
Man ls
Description: displays information about directories and files
Common parameters:
-l
List the details of the file / directory
-a
List all files (show hidden files)
Example:
Show the file name under the current folder
Ls
Show all child files under the current path
Ls-l
List in detail the contents of the current path in long format
Ls-a
Show all child files under the current path (including hidden files to. File at the beginning)
Ls-al
Show files in the / home directory
Ls / home
Displays the details of all files in the / home directory
Ls-al / home
4.mkdir & rmdir
Man mkdir
Description:
Create a directory
Common parameters:
-m
Create a directory and set permissions
-p
Recursively create a multi-tier directory
-v
Return to the prompt to create a directory
Example:
Create an empty directory
Mkdir dir1
Create multiple empty directories dir1 dir2 dir3
Mkdir dir1 dir2 dir3
Create a directory dir1 under / home/bluseli
Mkdir / home/bluseli/dir1
Create a directory dir1 under / home/bluseli and set the permissions of the directory to test2
Mkdir-m 777 / home/bluseli/dir1
Create / dir1 under / home/bluseli and then create dir2 (/ home/bluseli/ dir1/ dir2) recursively after dir1 is created
Mkdir-p / home/bluseli/ dir1/ dir2
Create three layers of information successively under / home/bluseli and return information
Mkdir-vp / home/bluseli/dir1/ dir2/ dir3
Create dir2 dir3 dir4 under dir1
Mkdir dir1/ {dir2, dir3, dir4}
Rmdir
Man rmdir
Description:
Delete folder (empty folder)
Common parameters:
-p Recursively delete a multi-tier empty folder
Example:
Delete test4 under / home/bluseli/test3
Rmdir / home/bluseli/test3/test4/
After deleting test7, test6 is empty, test6,test5 is empty again, and test5 is deleted again, but there are other files in bluseli that cannot be deleted if it is not empty
Rmdir-vp / home/bluseli/test5/test6/test7/
Delete test4 test5 test6 under / home/bluseli at the same time
Rmdir test4 test5 test6
5.rm
Man rm
Description:
Delete a file or directory
Common parameters:
-f
Ignore files that do not exist and no warning messages appear
-I
Default call that prompts you whether to delete the file
-r
Recursive deletion deletes everything under this folder
Example:
Delete a single file
Rm test1
Delete multiple files
Rm test1 test2 test3
Delete files in the specified directory
Rm / home/test
Delete folder dir1
Rm-r dir1/
Delete multiple folders dir1 dir2
Rm-r dir1/ dir2/
Delete the folder dir1 under the specified directory
Rm-r / home/dir1
Force deletion of test3,test3 non-empty
Rm-f test3
Delete all .c files under test2
Rm. / test2/*.c
6.ps & top
Man ps
Description:
View current process dynamics
Common parameters:
-m
Display memory information
-w
Show widening to show more information
-a
Show all users
-u
Display by user name and startup time order
-x
Show the process without a control terminal
-l
Display as a long list
Example:
Ps-aux to view the processes of other owners
Top
Man top
Description:
Process real-time monitoring
Common parameters:
Example:
Top
7.kill
Man kill
Description:
Force to stop the process
Common parameters:
Example:
Kill-9 process number
8.tar
Man tar
Description:
Packing and compressing
Common parameters:
Example:
Archiving and compression
Tar-cvzf archive filename files that need to be archived and compressed
Extract the archive file
Tar-the name of the archive file that needs to be extracted by xvfz
The above is all the contents of the article "examples of the usage of 8 commonly used commands in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.