Find great Linux commands at commandlinefu on Linux terminal

What is commandlinefu?

Have you ever heard of "commandlinefu" website? Many developers and system administrators have been posing very convenient Linux commands. You should be able to find some great Linux commands on the website.





You can search a part of Linux command or what you would like to do in the search box, so that you can get a list of Linux commands and its explanation.
http://www.commandlinefu.com/

However, when you are working on Linux terminal software, you may need to search a great Linux command, so you always need to switch to web browser to access the commandlinefu website, but if you are able to keep staying in the Linux terminal and search commandlinefu contents, that would be great.


Install commandlinefu search tool

Below is the tool's URL.
https://github.com/samirahmed/fu

Installing the tool is very easy as follows.
$ git clone git://github.com/samirahmed/fu.git
$ cd fu/
$ sudo make install


How to use the tool

It is easy to use the tool. You just need to type a keyword right after the "fu" command, so that the command shows a list of Linux commands and its explanation.

For example, as a search keyword, I use "ssh" as follows. Once the search result is shown, you just need to copy and past the command, so you can run a great Linux command very easily.

$ fu ssh
 1 #  output your microphone to a remote computer's speaker
 dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp

 2 #  Mount folder/filesystem through SSH
 sshfs name@server:/path/to/folder /path/to/mount/point

 3 #  Compare a remote file with a local file
 ssh user@host cat /path/to/remotefile | diff /path/to/localfile -

 4ms total:25
I also searched with "windows" (this is not a Linux command), but it searches command explanation, as a result of that, it shows some commands.
$ fu windows
 1 #  Shutdown a Windows machine from Linux
 net rpc shutdown -I ipAddressOfWindowsPC -U username%password

 2 #  Convert PDF to JPG
 for file in `ls *.pdf`; do convert -verbose -colorspace RGB -resize 800 -interlace none -density 300 -quality 80 $file `echo $file | sed 's/\.pdf$/\.jpg/'`; done

 3 #  Save your sessions in vim to resume later
 :mksession! 

 861ms total:25

By default, the "fu" command shows only 3 results, but if you need full results, you can add "-a" option, so that you can get all the search result.
$ fu -a ssh
 1 #  output your microphone to a remote computer's speaker
 dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp

 2 #  Mount folder/filesystem through SSH
 sshfs name@server:/path/to/folder /path/to/mount/point

 3 #  Compare a remote file with a local file
 ssh user@host cat /path/to/remotefile | diff /path/to/localfile -

 4 #  SSH connection through host in the middle
 ssh -t reachable_host ssh unreachable_host

 5 #  Copy your SSH public key on a remote machine for passwordless login - the easy way
 ssh-copy-id username@hostname

 6 #  Copy your ssh public key to a server from a machine that doesn't have ssh-copy-id
 cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

 7 #  Create a persistent connection to a machine
 ssh -MNf @

 8 #  Remove a line in a text file. Useful to fix
 ssh-keygen -R 

 9 #  Attach screen over ssh
 ssh -t remote_host screen -r

 10 #  directly ssh to host B that is only accessible through host A
 ssh -t hostA ssh hostB

 11 #  Synchronize date and time with a server over ssh
 date --set="$(ssh user@server date)"

 12 #  Duplicate installed packages from one machine to the other (RPM-based systems)
 ssh root@remote.host "rpm -qa" | xargs yum -y install

 13 #  Port Knocking!
 knock  3000 4000 5000 && ssh -p  user@host && knock  5000 4000 3000

 14 #  run complex remote shell cmds over ssh, without escaping quotes
 ssh host -l user $( /dev/null"

 22 #  Tell local Debian machine to install packages used by remote Debian machine
 ssh remotehost 'dpkg --get-selections' | dpkg --set-selections && dselect install

 23 #  throttle bandwidth with cstream
 tar -cj /backup | cstream -t 777k | ssh host 'tar -xj -C /backup'

 24 #  Resume scp of a big file
 rsync --partial --progress --rsh=ssh  $file_source $user@$host:$destination_file

 25 #  Single use vnc-over-ssh connection
 ssh -f -L 5900:localhost:5900 your.ssh.server "x11vnc -safer -localhost -nopw -once -display :0"; vinagre localhost:5900

 5ms total:25

Again, you can stay in a LInux terminal and can search some great Linux commands. Let's install the "fu" command now!