10+ Useful Commands for Linux Users

7:16 AM

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 root@remote.host "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

0 comments

» read more....

Introducing My Ebooks Collection Online Folder

6:57 PM

As a self-educated person in Linux and open-source, reading e-books is one of my methods to learn Linux. There are a lot e-books on the Internet talking about Linux and other computer stuff, but getting them in one place is too difficult because they are spread at the certain place on the Internet. Today, I'd like to share my e-books collection in one place so you can browse and download it easily. My collection contains many kinds of e-books about Linux, open-source, programming, and another computer stuff.


Some of my e-books come with Indonesian, and some with English. If you find any great Indonesian e-book, please free to contact its author for asking permission to translate it into your language. Well, if you're interested in checking my e-books collection, simply click the link below:

My e-books collection online folder

I will update that folder regularly, so please make sure to bookmark that page and check it regularly to get an updated e-books collection.

Regards.

0 comments

» read more....