Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Sunday, November 29, 2009

Linux command

* Listing files/folder
ls -lht
-l: long format
-h: human readable size (ex: 2k, 2M,..)
-t: sort by time (default = sort by name)
* Count number of line in file
wl -l filename
* Get last 100 line of a file and numbering
tail -100 source | nl > dest
* Remove whole directory and all files inside
rm -r folder_name
-r: recursive
* Backup a folder
tar -cvf file.tar folder_name
* Extract a file
tar -xvf file.tar
* Disk use:
du - sh
-s: only total sum
-h: size human format
du | sort -n (unix)
du | sort -g (fedora)
* Install package
sudo apt-get install vim-runtime
* Check disk space
df -h
* Check memory
prstat -a
vmstat
* Find file
find / -name filepattern
locate filepattern
* Mound a pen drive
mount /dev/sda1 /mnt/usbdisk
* Change mode
chmod ugo+rwx directory1
* Find text in files
find . -type f -exec grep "pattern" {} \;
* Make a pdf of a manual page
man -t man |ps2pdf - > man.pdf
* Go to previous directory
cd -

Monday, October 19, 2009

Useful windows command


  • http://commandwindows.com/doskey.htm

  • tasklist /svc list all services which are running

  • netstat -n -a list all port which are in using

  • msinfo32 system information

  • tracert The actual path between two computers on the Internet

  • pathping combine ping and tracert

  • nslookup diagnose the Domain Name System (DNS) infrastructure and comes with a number of sub-commands

  • netsh The network services shell is a large suite of many tools

Saturday, October 17, 2009

Manage port/firewall


  1. http://msdn.microsoft.com/en-us/library/cc646023.aspx

  2. netstat –n –a

  3. PortQry tool

  4. WF.msc (firewall rule)

  5. netsh firewall set portopening protocol = TCP port = 1433 name = SQLPort mode = ENABLE scope = SUBNET profile = CURRENT

  6. firewall.cpl