Posts Tagged ‘Commands’


Cool and Useful Linux Commands

Thursday, May 31st, 2012

wget -m -k    Mirror a website

grep -ril ‘search string’    Search all files in current directory and sub directory for string of text.

cat *  Displays contents of all files in current directory.

top   Shows all the current proccesses sorted from what is taking up the most CPU memory.

ps -aux  Same as top except sorted by PID

kill PID kill a process by the PID number obtained by “top” or “ps-aux”

df -Th  Show hard drive information including size and amount of space used

ls -hal  Show current files in directory including hidden files and display the file size in a easy to read format.

find / *.txt  Finds all text files with the .txt extension. Replace .txt with whatever you want. Not just limited to file extensions. Can search any aspect of file name as well.

locate FILE  Just like find but much much quicker. Not as complete but an excellent tool to find something quickly. (replace “FILE” with what you want to search for)

echo $RANDOM Prints a random number to the screen.

date  Displays date and time

play song.wav  Play audio files from the terminal

wc -m file  Displays amount of characters in a file. Can also be used as a pipe for strings of text. Example: echo ‘hello world12345″ | wc -m

wc -l file  Counts the number of lines in a file

cat /dev/zero > zero.file ; rm zero.file– Wipe Free Space on hard drive. Prevents data recovery. Very important to do before donating or recycling a computer even if you’ve already formatted.

less  –Like the cat command but displays one page at a time.

curl –socks localhost:555 whatismyip.net  –Test a socks proxy and displays IP of proxy. Works on all types of socks proxies.

curl –proxy localhost:555 whatismyip.net  –Test a HTTP proxy and displays IP of proxy. Great way to test if a proxy is up and if it’s running slow.


lynx –dump   Web browser for the terminal. Dumps the textual content from a web page.  Don’t use the dump feature if you want to browse around a site.

du -ch  Print file size of all directories in current directory and give a total file size at end in an easy to read format

whois   Get information on a domain name

ifconfig  Displays network devices information and network information. Similar to ipconfig in windows.

iwconfig Displays information for wifi devices.

ping  Ping a site or IP to test speed and to check if connected to internet

scp FILE [email protected]:~/

ssh -D 5555 [email protected] –Connect to your regular shell account, but creates a socks 5 proxy server on localost port 5555. (You can enter your own port number.

SECURITY COMMANDS

DO A SECURITY SCAN ON YOUR WEBSITE

Run as Root. M (add ‘sudo’ to from of command on Ubuntu and most Linux distros) Must have nmap installed.
nmap -A -v TARGET -Scans a website or IP number. Shows open ports and lots of other useful information. Great for testing the security of your website, network, or internet connected devices.

nmap -A -v -p- Just like above but scans ALL 65,535 TCP ports instead of the 1000 most common. Takes longer than above command but more complete.

nmap -A -p- -sU FULL UDP scan.

nikto -h website  –Does a security scan on a website. Uses many techniques. ONLY USE ON YOUR OWN SITE or have permission!  Great way to test the security of your site. Make sure to run NMAP as well.

 

MORE TO BE ADDED VERY SOON!