Cool Commands for Unix and Windows (ZZ)
2012-02-21 13:39
316 查看
These are some commands that I use in Windows and Unix/Linux for various purposes.
Windows (//z 2012-2-21 13:42:23 PM IS2120@CSDN)
//z 2012-2-21 13:42:23 PM IS2120@CSDN
Windows (//z 2012-2-21 13:42:23 PM IS2120@CSDN)
ipconfig | Show my IP address |
ipconfig \all | Show my host name, IP addr, MAC addr, subnet mask, DNS servers, etc. |
netstat | List all TCP connections |
netstat -a | List all active ports |
nslookup host | Get IP addr for host |
ping host | See if a host is accessible |
Unix/Linux
System related | |
uptime | Show how long the system has been up |
uname -a | Show the OS name and version |
hostname | Shows the machine's name |
ps -f -u username | Lists all the processes I'm running |
echo $0 | Shows what shell I'm using |
echo $path | Shows my path (or any environment variable) |
Network related | |
netstat | List all TCP connections |
netstat -a | List all active ports |
nslookup host | Get IP addr for host |
ping host | See if a host is accessible |
telnet domain_name 80 | Use telnet to make an HTTP request Example to view http://www.harding.edu/comp/: telnet www.harding.edu 80 GET /comp/ HTTP/1.1 Host: www.harding.edu |
Disk space (//z 2012-2-21 13:42:23 PM IS2120@CSDN) | |
df | Shows the amount of disk space in use |
df /node_or_dirname | Shows detailed information about the file system node or dir name |
du | Shows the amount of disk space used in every dir from current location |
du -ks ~fmccown | Shows the amount of disk space user fmccown is using (in KB) |
cd;du -k | sort -nr | more | Shows the disk space used (in KB) for every directory in sorted order |
File processing | |
file myfile | Short summary of what type of file myfile is |
cat file1 file2 > file3 | Concatenates file1 and file2 and stores the result in file3 |
sort file.txt | Sorts a file |
uniq file.txt | Remove duplicate lines from a sorted file |
wc file.txt | Counts number of lines, words, and characters in a file |
grep search_str file.txt | Search for a search_str in a files |
tail -f file.txt | List the contents of a file as it is being added to |
tail -n 100 file.txt | List the last 100 lines of a file |
find . -name "*html" | Find all files named *html starting in the current dir |
find . -exec grep "hello" '{}' \; -print | Run grep on all files starting in the current dir |
cat myfile | hexdump -C | Produce a hexdump of myfile |
File compression | |
tar cfz my.tar.gz *.html | Creates a gzipped tar file for all .html files |
tar -tzf my.tar.gz | Lists the contents of my.tar.gz |
tar xvfz my.tar.gz | Uncompresses and untars my.tar.gz |
gzip myfile.txt | Compresses myfile.txt creating myfile.txt.gz |
gzip -d myfile.txt.gz | Uncompresses myfile.txt.gz creating myfile.txt |
bzip2 myfile.txt | Compresses myfile.txt creating myfile.txt.bz2 (Use -k to keep myfile.txt) |
bzip2 -d myfile.txt.bz2 | Uncompresses myfile.txt.bz2 creating myfile.txt |
I/O redirection | |
cmd > log.txt | Redirect cmd output (stdout) to log.txt |
cmd >> log.txt | Append stdout to log.txt |
cmd 1> out_log.txt 2> err_log.txt | Send stdout to out_log.txt and stderr to err_log.txt |
cmd &> log.txt | Redirect stdout and stderr to log.txt. Note: use >& for C shell. |
Running processes | |
./cmd & | Run process in the background |
nohup ./cmd & | Run process in the background, and don't terminate when shell is terminated |
相关文章推荐
- DB2 SQL PL : Essential Guide for DB2 UDB on Linux, UNIX, Windows, i5/OS, and z/OS, Second Edition
- DB2 UDB v8 Handbook for Windows and UNIX/Linux
- Apache httpd, an open-source HTTP server for modern operating systems including UNIX and Windows NT
- [zz]Common loading points for viruses, worms, and Trojan horse programs on Windows 2000/XP/2003
- 删除svn隐藏目录SHELL命令(for windows and unix-like system)
- 删除svn隐藏目录SHELL命令(for windows and unix-like system)
- 13 Free Open Source NetFlow Analyzers for Windows and Linux/Unix
- 翻 译:Veritas.Netbackup.Enterprise.Server.6.0.Backup.Planning.And.Performance.Tuning.Guide.For.Unix,.Windows,.And.Linux
- [在windows上使用Unix工具]SUA+Interix+SFU+Utilities and SDK for UNIX-based Applications
- Timer Class for both Unix/Linux/Mac and Windows system
- [在windows上使用Unix工具]SUA+Interix+SFU+Utilities and SDK for UNIX-based Applications
- Designing and Implement ButtonEdit Control for Windows Forms
- Preparing for Application and Service Deployment-Debugging and Troubleshooting Windows Azure Applic
- linux/unix rules for naming file and directory
- Designing and Implement Lookup Control for Windows Forms
- UTF-8 and Unicode FAQ for Unix/Linux
- Special Ops: Host and Network Security for Microsoft, UNIX, and Oracle
- Accessibility and Ergonomic Guidelines for Windows Mobile(from MSDN)
- LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS (LINUX 和 WINDOWS的基本命令) part IV
- Scheduling R scripts and processes on Windows and Unix/Linux