Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Common linux commands

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "common linux commands", the content of the explanation is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "common linux commands" bar!

Command cpcp [parameter] [source file or directory] [destination file or directory] description: this command copies the specified source file to the target file or multiple source files to the destination directory parameter:-a this option is usually used when copying the directory, it retains links, file attributes And copy everything in the directory-f overwrites the existing target file without giving a prompt-I gives a prompt before overwriting the target file, asking the user to confirm whether to overwrite-r recursive copy, used to copy the directory-u source file is different from the target file before it will be copied

1) copy a file and rename it to b or copy a to b: cp a b

① if the target file / directory b does not exist, it means that an is copied and renamed to b (the original file a still exists)

② if the destination directory b already exists, it means to copy the a folder to the b folder

2) copy file a to the specified directory (ask if you want to overwrite): cp-I an app/soft

3) copy all the contents contained in test and its test to a new directory that already exists: cp-r test/ isTester/

4) copy all the contents under test to the new directory (excluding test itself): cp-r. / test/. IsTester/

5) copy all txt files in the current directory to a new directory: cp. / test/*.txt isTester/

6) copy file a to the parent directory: cp a.. /

7) move two files to the specified directory at the same time: cp a b app/soft

8) copy all the contents under the current folder to a higher-level directory: cp *.. /

9) Note:

If the ① replication folder ② directory ③ target file / directory does not exist, you can use-r

The current directory / file had better be added. /

Scpscp [parameter] [source file] [user name @ IP:/ destination path] description: secure remote file copy command parameter based on ssh login in linux system:-r recursively copy the entire directory-v display output in detail

1) copy the server files of the current operation to the remote server (operating in the 10.0.0.5 server): scp-r test root@10.0.0.223:/root/

2) copy the remote server files to the currently operating server (operating in the 10.0.0.223 server): scp-r anxin@10.0.0.5:/home/anxin/isTester/ / root/

[jboss@VM_10_91_centos] $scp-r test root@10.0.0.223:/root/ root@10.0.0.223's password: 4.txt 100% 19 0.0KB/s 00:00 5.txt 100% 75 0.1KB/s 00:00 8.txt 100% 5 0.0KB/s 00:00 9.txt 100% 13 0.0KB/s 00:00 6.txt 100 0.0KB/ S 00:00 4.txt 100% 19 0.0KB/s 00:00 5.txt 100% 75 0.1KB/s 00:00 Command rmdirrmdir [parameter] [pathname or file name] description: delete empty directory parameter:-p if the subdirectory is also made empty after it is deleted By the way, delete it.

1) delete an empty folder: rmdir a

2) Delete folder B under folder A: rmdir-p Amob B.

3) Note: the directory containing files cannot be deleted, only an empty folder can be deleted.

Command rmrm [parameter] [pathname or file name] description: delete a file or directory parameter:-I ask for confirmation one by one before deletion-f do not need to confirm one by one before deletion, directly delete-r delete the directory and the following files one by one

1) delete the files in the specified directory (without being asked whether to delete them): rm-f app/soft/a.txt

2) delete the files in the specified directory (you will be asked to delete them): rm-I app/soft/a.txt

3) Delete all txt files in the specified directory: rm-f app/soft/*.txt

4) forcibly delete the folder under the specified directory: rm-rf app/soft/b

5) forcibly delete all contents under the specified directory: rm-rf app/soft/*

Command historyhistory [parameter] description: used to display history and executed instruction commands, the command is saved in memory parameter:-N display history of the most recent N records;-c clear the current history command

1) View the history of command execution: history

2) View the most recent entries in the history of execution: history 5

3) execute the command with serial number 178 in the history record:! 178

4) View the execution history of a command: history | grep mkdir

5) use the last command:!

6) clear the current history command: history-c

Thank you for your reading, the above is the content of the "common linux commands", after the study of this article, I believe you have a deeper understanding of the common linux commands, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report