diff --git a/cheatsheets/apt-cache b/cheatsheets/apt-cache index 3af3023..6d34ef6 100644 --- a/cheatsheets/apt-cache +++ b/cheatsheets/apt-cache @@ -3,3 +3,10 @@ apt-cache search "whatever" # To display package records for the named package(s): apt-cache show pkg(s) + +# To display reverse dependencies of a package +apt-cache rdepends package_name + +# To display package versions, reverse dependencies and forward dependencies +# of a package +apt-cache showpkg package_name diff --git a/cheatsheets/apt-get b/cheatsheets/apt-get index 0f4bcd6..3888613 100644 --- a/cheatsheets/apt-get +++ b/cheatsheets/apt-get @@ -11,3 +11,6 @@ apt-get dist-upgrade # Full command: apt-get update && apt-get dist-upgrade + +# To install a new package(s) +apt-get install package(s) diff --git a/cheatsheets/dhclient b/cheatsheets/dhclient index 028530e..1e2ee60 100644 --- a/cheatsheets/dhclient +++ b/cheatsheets/dhclient @@ -5,3 +5,6 @@ sudo dhclient -r sudo dhclient # Running the above in sequence is a common way of refreshing an IP. + +# To obtain a new IP address for a specific interface: +sudo dhclient eth0 diff --git a/cheatsheets/git b/cheatsheets/git index 9688ae6..22b538c 100644 --- a/cheatsheets/git +++ b/cheatsheets/git @@ -26,6 +26,9 @@ git push git@github.com:username/project.git # To delete the branch "branch_name" git branch -D branch_name +# To see who commited which line in a file +git blame filename + # To sync a fork with the master repo: git remote add upstream git@github.com:name/repo.git # Set a new repo git remote -v # Confirm new remote repo diff --git a/cheatsheets/grep b/cheatsheets/grep index aeb2de3..3a01723 100644 --- a/cheatsheets/grep +++ b/cheatsheets/grep @@ -10,6 +10,13 @@ grep -R pattern folder # Getting pattern from file (one by line): grep -f pattern_file file +# Find lines NOT containing pattern +grep -v pattern file + +# You can grep with regular expressions +grep "^00" file #Match lines starting with 00 +grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" file #Find IP add + # Find all files who contain {pattern} in the directory {directory}. # This will show: "file:line my research" grep -rnw 'directory' -e "pattern" diff --git a/cheatsheets/ifconfig b/cheatsheets/ifconfig index ca0b9d1..32da1a2 100644 --- a/cheatsheets/ifconfig +++ b/cheatsheets/ifconfig @@ -5,9 +5,10 @@ ifconfig wlan0 ifconfig -a # Take down / up the wireless adapter -ifconfig {up|down} wlan0 +ifconfig wlan0 {up|down} # Set a static IP and netmask ifconfig eth0 192.168.1.100 netmask 255.255.255.0 + # You may also need to add a gateway IP route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 diff --git a/cheatsheets/mount b/cheatsheets/mount index e377002..7b81d93 100644 --- a/cheatsheets/mount +++ b/cheatsheets/mount @@ -3,3 +3,6 @@ mount -o remount,rw / # To mount Usb disk as user writable: mount -o uid=username,gid=usergroup /dev/sdx /mnt/xxx + +# To mount a remote NFS directory +mount -t nfs example.com:/remote/example/dir /local/example/dir diff --git a/cheatsheets/python b/cheatsheets/python index 498cd15..d4d14dc 100644 --- a/cheatsheets/python +++ b/cheatsheets/python @@ -11,3 +11,6 @@ python -m http.server 8000 # SMTP-Server for debugging, messages will be discarded, and printed on stdout. python -m smtpd -n -c DebuggingServer localhost:1025 + +# Pretty print a json +python -mjson.tool diff --git a/cheatsheets/ssh b/cheatsheets/ssh index bcd8640..ee40c57 100644 --- a/cheatsheets/ssh +++ b/cheatsheets/ssh @@ -13,5 +13,8 @@ ssh -X user@example.com # To launch a specific x application over SSH: ssh -X -t user@example.com 'chromium-browser' +# To create a SOCKS proxy on localhost and port 9999 +ssh -D 9999 user@example.com + # For more information, see: # http://unix.stackexchange.com/q/12755/44856