Linux command prompt is the most interesting place in the system. You can do a lot with it. You can do everything you want and get the "exact" answer about what is going on. Here are some useful Linux commands you could take some advantages from.

1. Save man-page asPDF file
For example, you want save the manpage of APT to PDF file.
  • man -t apt | ps2pdf - apt.pdf

2. Duplicate installed packages from one machine to the other (RPM-based systems)
  • ssh "rpm -qa" | xargs yum -y install

3. Stamp a text line on top of the PDF pages
This command will add a stamp "This text gets stamped on the top of the pdf pages." on top of each PDF pages.
  • echo "This text gets stamped on the top of the pdf pages." | enscript -B -f Courier-Bold16 -o- | ps2pdf - | pdftk input.pdf stamp - output output.pdf

4. Display the number of connections to a MySQL Database
  • mysql -u root -p -BNe "select host,count(host) from processlist group by host;" information_schema

5. Create a local compressed archive (tarball) from remote host directory
  • ssh user@host "tar -zcf - /path/to/dir" > dir.tar.gz

6. View a brief log over ssh
  • ssh -t remotebox "tail -f /var/log/remote.log"

7. Print diagram of user or group
  • awk 'BEGIN{FS=":"; print "digraph{"}{split($4, a, ","); for (i in a) printf "\"%s\" [shape=box]\n\"%s\" -> \"%s\"\n", $1, a[i], $1}END{print "}"}' /etc/group|display

8. Draw kernel module dependency graph
  • lsmod | perl -e 'print "digraph \"lsmod\" {";<>;while(<>){@_=split/\s+/; print "\"$_[0]\" -> \"$_\"\n" for split/,/,$_[3]}print "}"' | dot -Tpng | display -

9. Generate strong password
  • read -s pass; echo $pass | md5sum | base64 | cut -c -16

10. Find all files larger than 500M and less than 1GB
  • find / -type f -size +500M -size -1G

11. Limit the cpu usage of a process
  • sudo cpulimit -p pid -l 50

via: Unixmen

, ,

About the Author

Damar Riyadi is a chief and owner of , Damar Riyadi joining the UB! since september 2011, he commit to bring a quality ubuntu review and article for you. Interested with him, find him in Google + , Facebook , and Launchpad.