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

What are the common commands of Linux Shell

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

Share

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

What are the common commands in cloud computing? Many friends who learn cloud computing will be troubled by complex commands when learning Linux. How to quickly master and skillfully use these commands? Here are a summary of 50 commonly used Linux Shell commands, keeping these in mind will be of great help to your future study and work.

1. Transfer the process to the foreground: fg

2. Let the process go to the background: Ctrl + z

3. Check whether the remote port is open to bash: echo > / dev/tcp/8.8.8.8/53 & & echo "open"

4. Execute the command in a file in the current shell: source / home/user/file.name

5. SSH debug mode: ssh-vvv user@ip_address

6. SSH with pem key:ssh user@ip_address-I key.pem

7. Create multiple directories at a time: mkdir-p / home/user/ {test,test1,test2}

8. Create a war file: jar-cvf name.war file

9. Test the hard disk write speed: dd if=/dev/zero of=/tmp/output.img bs=8k count=256k; rm-rf / tmp/output.img

10. Test hard disk read speed: hdparm-Tt / dev/sda

11. Get the md5 hash:echo-n "text" of the text | md5sum

12. Check xml format: xmllint-- noout file.xml

13. Extract tar.gz to a new directory: tar zxvf package.tar.gz-C new_dir

14. Use curl to get HTTP header information: curl-I http://www.example.com

15. Time stamp for modifying a file or directory (YYMMDDhhmm): touch-t 0712250000 file

16. Use wget command to execute ftp download: wget-m ftp://username:password@hostname

17. Generate a random password (16 characters in the example): LANG=c

< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;   18、快速备份一个文件:cp some_file_name{,.bkp}   19、访问Windows共享目录:smbclient -U "DOMAIN\\user" //dc.domain.com/share/test/dir   20、执行历史记录里的命令(这里是第100行):!100   21、解压:unzip package_name.zip -d dir_name   22、输入多行文字(CTRL + d 退出):cat >

Test.txt

23. Create an empty file or empty an existing file:\ > test.txt

24. Synchronize time with Ubuntu NTP server: ntpdate ntp.ubuntu.com

25. Use netstat to display all tcp4 listening ports: netstat-lnt4 | awk'{print $4}'| cut-f2-d: | grep-o'[0-9] *'

26. Qcow2 image file conversion: qemu-img convert-f qcow2-O raw precise-server-cloudimg-amd64-disk1.img\ precise-server-cloudimg-amd64-disk1.raw

27. Run the file repeatedly to show its output (default is once every 2 seconds): watch ps-ef

28. List of all users: getent passwd

29. Mount root in read/write mode:mount-o remount,rw /

30. Mount a directory (this is the case where links cannot be used): mount-- bind / source / destination

31. Update DNS server dynamically

32. Recursively grep all directories: grep-r "some_text" / path/to/dir

33. List the top 10 largest files: lsof / | awk'{if ($7 > 1048576) print $1048576 "MB" $9}'| sort-n-u | tail

34. Display remaining MB: free-m | grep cache | awk'/ [0-9] / {print $4 "MB"}'

35. Open Vim and skip to the end of the file: vim + some_file_name

36. Git clone designated branch (master): git clone git@github.com:name/app.git-b master

37. Git switches to other branches (develop): git checkout develop

38. Git delete branch (myfeature): git branch-d myfeature

39. Git deletes the remote branch: git push origin: branchName

40. Git pushes the new branch to the remote server: git push-u origin mynewfeature

41. The last cat command in print history:! cat:p

42. The last cat command in the running history:! cat

43. Find all the empty subdirectories under / home/user: find / home/user-maxdepth 1-type d-empty

forty-four。 Get the 50-60 lines in the test.txt file: < test.txt sed-n '50j 60p'

45. Run the last command (if the last command is mkdir / root/test, you will run: sudo mkdir / root/test): sudo!

46. Create a temporary RAM file system-ramdisk (create the / tmpram directory first): mount-t tmpfs tmpfs / tmpram-o size=512m

47. List all kill signal parameters: kill-l

48. Disable recording of the last session in bash history: kill-9 $$

49. Scan the network for open ports: nmap-p 8081 172.20.0.

50. Set git email:git config-- global user.email me@example.com

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