Cool Unix, Windows Commands

  • Uploaded by: vaibhavkanwal
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Cool Unix, Windows Commands as PDF for free.

More details

  • Words: 502
  • Pages: 2
Cool Commands for Unix and Windows These are some commands that I use in Windows and Unix/Linux for various purposes.

Windows 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 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 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

1

Home

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

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

2

Related Documents

Unix Commands
April 2020 10
Unix Commands
July 2020 7
Unix Commands
November 2019 20
Unix Commands
April 2020 8
Unix Commands
June 2020 4

More Documents from "api-26041653"