Advertisement
Guest User

Untitled

a guest
Oct 24th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.86 KB | None | 0 0
  1. /* STORAGE / FILESYSTEM / MOUNTS / PERMISSIONS
  2.  *********************************************/
  3.  
  4. # Lists storage devices and mount points
  5.     lsblk                       // aliased from 'lsblk -o NAME,SIZE,FSTYPE,LABEL,UUID,MOUNTPOINT'
  6.     blkid                       // Useful to get partition UUID's
  7.  
  8. # List files
  9.    ls                          // aliased from ' ls++'; uses plugin
  10.    lsl                         // aliased from '\ls --color=auto   --group-directories-first -Ah'
  11.    lsr                         // aliased from 'ls -ltr'; displays files by modification date
  12.  
  13. # Lists mount points and used/available space
  14.    df                          // aliased from 'df -h -P --total --exclude-type=devtmpfs 2>/dev/null'
  15.    df -hPT                     // -T shows filesystem type
  16.  
  17. # Disk usage and management
  18.    ncdu
  19.  
  20. # Lists all directories
  21.    tree                        // aliased from 'tree -dA'
  22.    tree -L 2                   // as above but limits to 2 layers deep
  23.  
  24. # Change ownership and permissions
  25.    chmod
  26.    sudo chmod -R 700 <foldername>              // Require root to access folder
  27.    chown
  28.    chown -R <user>:<group> path/to/directory   // Change owner of entire directory recursively
  29.  
  30. # Display files and directories in current directory, from smallest to largest
  31.    du                          // aliased from 'du -sm ./* | sort -n'
  32.  
  33. # Kills process locking a file
  34.    fuser -k <filename>        
  35.  
  36.  
  37.  
  38.  
  39.  
  40. /* SYSTEM MONITORING / STATISTICS
  41. ********************************/
  42.  
  43. # Sysstat performance monitoring utilities
  44.    sar                         // collects all system statistics
  45.    sar 1 3                     // prints stats every 1 second, does it 3 times
  46.    iostat                      // CPU and IO stats
  47.    mpstat                      // aliased from 'mpstat -P ALL'; CPU stats
  48.    pidstat                     // Process ID stats
  49.    pidstat -d <#>              // Reports disk IO in intervals of '#' seconds
  50.  
  51. # Displays system statistics in real time
  52.     top
  53.     htop
  54.  
  55. # Displays uptime and users
  56.     w
  57.  
  58. # Displays tree of active processes
  59.     pstree
  60.  
  61. # Displays running processes
  62.     ps
  63.     ps aux | grep <processname> // Displays all running processes containing <processname>
  64.     ps -u <username>            // Show all processes by specific user
  65.     cpuu                        // Process CPU Usage; from 'ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10'
  66.  
  67.  
  68.  
  69.  
  70. /* BENCHMARKING
  71.  **************/
  72.  
  73. # Read 32GB's then toss it
  74.     dd if=/dev/zero of=/dev/null bs=1M count=32768
  75.  
  76.  
  77.  
  78.  
  79.  
  80. /* NETWORKING / SECURITY
  81.  ***********************/
  82.  
  83. # Display status of network interfaces
  84.     ipa                         // all interfaces; aliased from 'ip address show scope global up'
  85.     ip4                         // ipv4 interfaces aliased from 'ip -4 address show scope global up'
  86.     ip6                         // ipv6 interfaces aliased from 'ip -6 address show scope global up'
  87.     ipr                         // routing details aliased from 'ip -4 route show scope global'
  88.     ip6r                        // ipv6 routing details aliased from 'ip -6 route show scope global'
  89.     ifconfig                    // Also displays interface information
  90.     ifconfig eth0 192.168.1.1   // Assigns an address to an interface
  91.     ifconfig eth0:1 10.0.0.53   // Creates virtual interface linked to real interface
  92.     ifconfig wlan1 up           // Enables an interface ('eth0 down' disables eth0 interface)
  93.     ip route get 8.8.8.8        // Easy way to find active interface quickly
  94.  
  95. # Shows current active connections
  96.     netconnections              // aliased from 'netstat -tuapw --numeric-hosts --numeric-ports'
  97.  
  98. # Gives current WAN IP address
  99.     wanip                       // aliased from 'curl ipinfo.io/ip'
  100.  
  101. # Test if local/network firewall blocks telnet; no output if network firewall block in place
  102.     tcpdump host <ip of source>
  103.  
  104. # Displays network statistics in real time
  105.     iptraf-ng                   // Will require sudo/root
  106.  
  107. # Displays firewall rules
  108.     iptables -L
  109.  
  110. # Network exploration tool and scanner
  111.     nmap
  112.     nmap -p80 192.168.1.0/24                    // Scans range 192.168.1.0 - 192.168.1.255 for port 80
  113.     nmap -sT -sU -T5 192.168.1.0/24 -p 1-1024   // Stealth TCP/UDP scan for first 1024 ports
  114.     nmap -sP <LAN IP>                           // Shows all active IP addresses on LAN
  115.  
  116. # Traceroute 2.0
  117.     mtr
  118.  
  119. # Calculates network assignments
  120.     ipcalc
  121.  
  122. # Shows program bandwidth use
  123.     nethogs
  124.  
  125. # Shows bandwidth use on an interface
  126.     iftop
  127.  
  128. # Lookup domains
  129.     nslookup <www.address.com>
  130.     nslookup <www.address.com> 8.8.8.8          // Does the domain lookup from google's public DNS
  131.  
  132. # List network activity
  133.    lsof -i                                     // All activity
  134.    lsof -i :80                                 // Only web processes using port 80
  135.    lsof -P -i -n                               // Shows all applications using the internet
  136.  
  137. # SSH through intermediary if host is unreachable from local network
  138.    ssh -t <reachablehost> ssh <unreachablehost>
  139.  
  140.  
  141.  
  142.  
  143.  
  144. /* SEARCHING / EDITING / REGULAR EXPRESSIONS
  145. *******************************************/
  146.  
  147. # Outputs a column, where 'x' indicates the column number
  148.    awk '{ print $x }'
  149.  
  150. # Case insensitive recursive search through files from current directory for <string> and prints line number
  151.    grep -iTrn <string> *
  152.  
  153. # Escape aliases to run regular command
  154.    \<command>                  // Yeah it's that easy.
  155.  
  156.  
  157.  
  158.  
  159.  
  160. /* FUN
  161.  *****/
  162.  
  163. # Cow tells you something in pretty colors
  164.     moo                         // aliased from 'fortune | cowsay | lolcat'
  165.  
  166. # Does a matrix thing
  167.     cmatrix
  168.  
  169. # Prints system info with image
  170.     neofetch
  171.  
  172. # Makes a choo choo train
  173.     sl
  174.  
  175. # Terminal Calculator, can do conversions, too
  176.     calc                        // aliased from 'qalc' because q is awkward to type
  177.  
  178. # Accounting tool
  179.     ledger
  180.  
  181. # hackernews / y-combinator in the terminal
  182.     haxor-news
  183.     hn top                      // Shows top stories, other options available
  184.     hn view <#> -c              // Use this to view comments, replace '#' with the story number
  185.  
  186. # Display weather forecast
  187.     wttr.in
  188.  
  189. # Prints your most commonly used commands
  190.     history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
  191.  
  192. # Hexadecimal dump of /dev/urandom
  193.     hexdump -C /dev/urandom | grep 13\ 37   // grep highlights characters in the dump
  194.  
  195. # Prints an infinite loop installation screen that does nothing
  196.     j=0;while true; do let j=$j+1; for i in $(seq 0 20 100); do echo $i;sleep 1; done | dialog --gauge "Install part $j
  197.    : `sed $(perl -e "print int rand(99999)")"q;d" /usr/share/dict/words`" 6 40;done
  198.  
  199. # Opens firefox in a sandbox, whitelists custom homepage, and disowns it from the terminal
  200.     firejail --whitelist=~/public/Homepage firefox & disown
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement