Linux commandline tips 3

From Wiki
Jump to navigation Jump to search
  • Download a file and uncompress it while it downloads
$wget http://URL/FILE.tar.gz -O - | tar xfz -
  • If you play loto, try this command to generate the 6 numbers :
$echo $(shuf -n 6 -i 1-49 | sort -n)
  • To get the CPU temperature continuously on the desktop
$while :; do acpi -t | osd_cat -p bottom ; sleep 1; done &
  • Search for large files and show size and location.
$find . -size +100000k -exec du -h {} \;
  • Get a random Command
$ls /usr/bin | shuf -n 1

This is useful if you want to explore various random commands.

More commands :

  • Bash logger :Log everything from a bash script to a file
$script /tmp/log.txt
  • Using NMAP to check if a port is open or close
$nmap -oG - -T4 -p22 -v | grep ssh
  • Get the IP of the host your coming from when logged in remotely
$echo ${SSH_CLIENT%% *}