In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces what are the commonly used commands in Linux, the article is very detailed, has a certain reference value, interested friends must read it!
ls -alrtAFR
-a Displays all files and directories (ls defaults file or directory names to start with ". "as hidden files, not listed)
-l In addition to the file name, it also lists the file type, permissions, owner, file size and other information in detail.
-r Display documents in reverse order (originally alphabetical)
- tList documents in chronological order of creation
-A Same as-a but without listing "... " (current list) and"... " (parent directory)
-F Add a symbol after the name of the file listed; for example, add "*" for executable files and "/" for directories
-R If there are files in the directory, the following files are listed in order
touch -acfm-r--help[file or directory…]
Time attributes used to modify files or directories, including access time and change time. If the file does not exist, a new file is created.
mkdir [-p] dirName
-p Make sure directory names exist, or create one if they don't.
mkdir -p BBB/Test In the BBB directory under the working directory, create a subdirectory called Test. If the BBB directory does not already exist, create one. (Note: If-p is not added in this example, and the original BBB directory does not exist, an error will occur.)
rm [options] name...
-i Ask for confirmation one by one before deleting.
-f Even if the original file attribute is set to read-only, it is deleted directly without confirmation.
-r Delete the directory and the following files one by one.
mv [options] source dest
-i: If the specified directory already has a file with the same name, ask if you want to overwrite the old file first;
-f: no indication when mv operation is to overwrite an existing target file;
mv filename filename Change source filename to destination filename
mv file name directory name move file to destination directory
mv directory name directory name target directory already exists, move source directory to target directory; target directory does not exist, rename
mv directory name file name error
cp [options] source dest
-a: This option is typically used when copying directories, preserving links, file attributes, and copying everything under the directory. Its effect is equal to the dpR parameter combination.
-d: Keep links when copying. The links mentioned here are equivalent to shortcuts in Windows.
-f: Overwrites existing target files without prompting.
-i: In contrast to the-f option, a prompt is given before overwriting the target file, asking the user to confirm whether the target file is overwritten, and the target file will be overwritten if the answer is "y."
-p: In addition to copying the contents of the file, the modification time and access rights are also copied to the new file.
-r: If the given source file is a directory file, all subdirectories and files under the directory will be copied.
-l: Do not copy files, only generate link files.
cat -AbeEnstTuv [--version] fileName
-n or--number: Number all output rows starting with 1.
-b or--number-nonblank: Similar to-n except that blank lines are not numbered.
-s or--squeeze-blank: When there are more than two consecutive blank lines, replace them with one blank line.
scp [optional parameters] file_source file_target
-r: Recursively copy the entire directory.
-P port: Note that the capital P, port is the port number used to specify data transmission
1. Copy from local to remote
scp local_file remote_username@remote_ip:remote_folder
or
scp local_file remote_username@remote_ip:remote_file
or
scp local_file remote_ip:remote_folder
or
scp local_file remote_ip:remote_file
The 1st and 2nd specify the user name, and the password needs to be entered after the command is executed. The 1st only specifies the remote directory, and the file name remains unchanged. The 2nd specifies the file name.
The 3rd and 4th do not specify the username, and the user name and password need to be entered after the command is executed. The 3rd only specifies the remote directory, and the file name remains unchanged. The 4th specifies the file name.
Application examples:
scp /home/space/music/1.mp3 root@www.runoob.com:/home/root/others/musicscp /home/space/music/1.mp3 root@www.runoob.com:/home/root/others/music/001.mp3scp /home/space/music/1.mp3 www.runoob.com:/home/root/others/musicscp /home/space/music/1.mp3 www.runoob.com:/home/root/others/music/001.mp3
Copy directory command format:
scp -r local_folder remote_username@remote_ip:remote_folder
or
scp -r local_folder remote_ip:remote_folder
The first specifies the username, and the password needs to be entered after the command is executed;
The second does not specify a user name, and the user name and password need to be entered after the command is executed;
Application examples:
scp -r /home/space/music/ root@www.runoob.com:/home/root/others/scp -r /home/space/music/ www.runoob.com:/home/root/others/
The above command copies the local music directory to the remote others directory.
2. Copy from remote to local
To copy from remote to local, simply reverse the order of the last two parameters of the command copied from local to remote, as follows
Application examples:
scp root@www.runoob.com:/home/root/others/music /home/space/music/1.mp3scp -r www.runoob.com:/home/root/others/ /home/space/music/
description
1. If the remote server firewall has a specified port set for the scp command, we need to use the-P parameter to set the port number of the command, as follows:
scp -P 4588 remote@www.runoob.com:/usr/local/sin.sh #scp command Use port number 4588 Use scp command Make sure that the user you are using has permission to read the file on the remote server, otherwise scp command will not work.
rcp
rcp -pr[target file or directory]
rcp -pr[object file]
-p Preserves attributes of the source file or directory, including owner, group, permissions, and time.
-r Recursive processing, the specified directory files and subdirectories together.
Use the rcp command to copy remote files to local storage.
Set the current account of the local host as rootlocal and the remote host account as root. To copy the file "testfile" from the home directory of the remote host (218.6.132.5) to the local directory "test", enter the following command:
rcp root@218.6.132.5:./ testfile testfile #Copy remote files locally rcp 218.6.132.5:home/rootlocal/testfile testfile #Requires current login account cmd to log in to remote host rcp 218.6.132.5:./ testfile testfile
ftp -dignv
tftp [host name or IP address]
tar
-c or--create Create a new backup file.
-t or--list Lists the contents of backup files.
-x or--extract or--get Restore files from backup files.
-z or--gzip or--ungzip Process backup files with the gzip command.
-f or--file= Specifies the backup file.
-v or--verbose shows instruction execution.
Compressed files are not packaged
# touch a. c#tar -czvf test.tar.gz a. c//compress a.c file to test.tar.gz
a.c
List compressed file contents
# tar -tzvf test.tar.gz-rw-r--r-- root/root 0 2010-05-24 16:51:59 a.c
extract the files
# tar -xzvf test.tar.gz a.c
gzip
-c or--stdout or--to-stdout Output the compressed file to standard output devices without altering the original file.
-d or--decompress or---uncompress to decompress files.
-f or--force Forcibly compresses files. Regardless of whether a file name or hard link exists and whether the file is a symbolic link.
-l or--list Lists information about compressed files.
-r or--recursive Recursive processing, all files and subdirectories under the specified directory are processed together.
-v or--verbose shows instruction execution.
compressed file
[root root@w3cschool.cc a]# ls //Show current directory file a.c b.h d.cpp[root@w3cschool.cc a]# gzip * //All files in compressed directory [root@w3cschool.cc a]# ls //Show current directory file a.c.gz b.h.gz d.cpp.gz[w3cschool.cc a]#
List detailed information
[root root@w3cschool.cc a]# gzip -dv * //extract file and list details a.c.gz: 0.0% -- replaced with a.cb.h.gz: 0.0% -- replaced with b.hd.cpp.gz: 0.0% -- replaced with d.cpp[w3cschool.cc a]#
Display compressed file information
[root@w3cschool.cc a]# gzip -l *compressed uncompressed ratio uncompressed_name24 0 0.0% a.c24 0 0.0% b.h26 0 0.0% d.cpp
zip
Package all files and folders in/home/html/into html.zip in the current directory:
zip -q -r html.zip /home/html
If we are in the/home/html directory, we can execute the following command:
zip -q -r html.zip *
Delete file a.c from compressed file cp.zip
zip -dv cp.zip a.c
unzip
View the files contained in the compressed file:
# unzip -l abc.zip
The-v parameter is used to view the compressed file directory information, but does not extract the file.
# unzip -v abc.zip
kill
kill 12345 kill process
other
Environment variable cmd:sysdm.cpl
The above are all the contents of what are commonly used commands in Linux. Thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to 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.