Common shell commands

Source: Internet
Author: User

1. See if a program is running
ps–ef|greptomcat 查看所有有关tomcat的进程
2. Terminating a thread
kill-9 2222 
3. View files, including hidden files
ls-al
4. Current working directory
pwd
5. Copying files
cpsource dest 复制文件cp -r sourceFolder targetFolder 递归复制整个文件夹scpsourecFile [email protected]:remoteAddr 远程拷贝
6. Create a Directory
mkdir Newdir
7. Deleting a directory
rmdirdeleteEmptyFolder 删除空目录 rm-rf deleteFile 递归删除目录中所有内容
8. Move files
mv/temp/movefile/targetFolder
9. Re-order
mvoldNameFile newNameFile
10. Switch users
su-username
11. Modify File Permissions
chmod777 file.java //file.java的权限-rwxrwxrwx,r表示读、w表示写、x表示可执行
12. Compressing files
tar-czf test.tar.gz /test1/test2
13. List Compressed Files
tar-tzf test.tar.gz
14. Extracting Files
tar-xvzf test.tar.gz
16. View file Header 10 lines
head-n 10 example.txt
17. View the end of the file 10 lines
tail-n 10 example.txt
18. View the log type file
1 tail-f exmaple.log //这个命令会自动显示新增内容,屏幕只显示10行内容的(可设置)。
19. Execute commands with Super Administrator status
sudorma.txt 使用管理员身份删除文件
20. View Port Usage
netstat-tln | grep8080 查看端口8080的使用情况
21. See which program the port belongs to
lsof-i :8080
22. View the process
psaux|grep java 查看java进程psaux 查看所有进程
23. List the contents of the directory in a tree view
tree a

Ps:mac using the tree command

24. File download
wget http://file.tgzcurl http://file.tgz

Install wget command under Mac

25. Network detection
pingwww.just-ping.com
26. Telnet
ssh[email protected]
27. Printing information
echo$JAVA_HOME 打印java home环境变量的值
28.java Common Commands

Java Javac JPS, Jstat, Jmap, Jstack

29. Other Commands

svn git maven

Common shell commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.