I have many files in a directory on Linux. How to find top K largest files in a directory? For example, find top 10 (K=10) large files in the current directory: du -h –max-depth 1 * | sort -rh | head -n 10
Tag: Tutorial
How to find files in a directory that are larger than certain size?
Posted onI have many files under a directory. How to find those files under the directory that are larger than certain size, say 500MB? Find the files that are larger than 500MB in the current directory (./): find ./ -size +500M Prints our more information about these files: find ./ -size +500M -exec ls -lh {}
Read more
How to change the fonts used in Gnome 3?
Posted onHow to change the fonts used in Gnome 3? The default configuration tool of gnome does not provide an option to change the fonts. However, the gnome-tweak-tool provides it. If you have not installed it, you need to install it first. On Fedora, run # yum install gnome-tweak-tool. Then you can run gnome-tweak-tool and set
Read more
How to change the fonts of gnome-shell for gnome3?
Posted onHow to change the fonts of gnome-shell for gnome3? Like the system bar. The fonts of gnome-shell is described in its own theme. For the default gnome-shell, you need to edit the file as root: /usr/share/gnome-shell/theme/gnome-shell.css Right, it is a css file. Find the font-family keyword and change the corresponding fonts. Then you can restart
Read more
How to find broken soft links in a directory?
Posted onHow to find broken symbolic links in a directory which have many symbolic links? Use this command to find broken soft links: find -xtype l /path/to/dir/to/find/in/ You can also specify the action by -exec. For example, delete the soft links that are broken in the current directory: find -xtype l -exec rm -f {} ;
Read more
Random string password generator in Scala
Posted onManaging our research cluster, I frequently need to generate some string for new users’ password. How to generate them automatically and randomly in Scala? The passwords need characters ‘a’ – ‘z’, ‘A’ – ‘Z’ and ‘0’ – ‘9’ only. This piece of code works very well for me: def randomString(len: Int): String = { val
Read more
How to change my Linux password
Posted onHow to change my password on a Linux box? The original password is generated by the administrator for me. User the passwd command. The easiest way: Log in the Linux box with your account Run passwd and it will ask your old and new passwords.
How to write paper reviews?
Posted onSometimes, we need to write paper reviews after read many papers which belong to a specific area (like information retrieval). I have found some useful links which are as follows. http://www.uwlax.edu/biology/communication/ReviewPapers.htmlhttps://users.ece.utexas.edu/~miryung/teaching/EE382V-Fall2009/review.html
How to allow contributors to Upload Files in wordpress
Posted onHow to allow contributors to Upload Files in wordpress? I allow my wordpress site’s contributors to submit posts. But by default, WordPress contributors do not have the capability to upload files. How to allow them to upload files? The key to my solution to add the upload files capability to contributors in WordPress is the
Read more
How to convert A4 paper format to read on Kindle 5
Posted onKindle is good for reading. However, the A4-size technical/academic paper is pain to read on Kindle 5—the fonts are too small. The “email to Kindl” converting tool provided by Amazon usually loses the formats in the technical paper. How to convert A4 paper format to read on Kindle 5? I use k2pdfopt tool (hey, source
Read more
How to make eps files using gnuplot
Posted onHow to make gnuplot generate eps files instead of plot the figures on screen? First, save a Gnuplot plot as a PostScript file by this commands: # gnuplot> load ‘saveplot’ # gnuplot> !mv my-plot.ps another-file.ps The saveplot file’s content: set size 1.0, 0.6 set terminal postscript portrait enhanced mono dashed lw 1 “Helvetica” 14 set
Read more
How to convert a .docx .doc MS Word file to pdf in command line on Linux
Posted onHow to convert a MS Word document file such as .docx and .doc to pdf on Linux using command line tools? Use LibreOffice: libreoffice –headless –convert-to pdf –outdir /path/to/out/dir/ /path/to/doc/docx/file While this LibreOffice answer works, the –headless option still needs as display, even though it does not use it. In otherwords, this option won’t work
Read more
Rsync with non-standard ssh ports
Posted onThis problem appears when I try to rsync directories with hosts inside a cluster used NAT for forwarding ports to internal nodes. Hence, the ssh port for internal nodes are not the default 22. So, how to use rsync with the non-standard ssh ports? The -e options of rsync play the trick very well. For
Read more
How to change the window title font family and size in Gnome 3?
Posted onIt was ever possible to set it in gnome-teak-tool. However, in the latest Gnome 3, it disappears. Is there any other way to set it? The configuration is the org.gnome.desktop.wm.preferences titlebar-font under dconf. You can use dconf-editor to find the appropriate key entry and set it. Or use gsettings: $ gsettings set org.gnome.desktop.wm.preferences titlebar-font ‘Sans
Read more
How to install Python environment in my own account on Dreamhost?
Posted onHow to install Python environment in my own account on Dreamhost so that my application can use the python that I installed by myself instead of the system-wide one? The post for Bluehost works very well for Dreamhost too: https://my.bluehost.com/cgi/help/python-install In short: mkdir ~/python cd ~/python wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz tar zxfv Python-2.7.2.tgz find ~/python -type d
Read more
How to revert only one file back to a revision or commit
Posted onI messed up with one file in one repository and want to check out only that file back to a commit. How to achieve this? To check the file with my_file.name at git commit commit_sha1: $ git checkout commit_sha1 my_file.name You can also use the relative commit instead of commit_sha1 such as master~4, HEAD~4, HEAD^,
Read more
How to use LVM groups with libvirt
Posted onlibvirt uses files for VM images by default under /var/lib/libvirt/images/. LVM is a convenient tool for managing VM images. How to use LVM groups with libvirt? This post discusses the method to add LVM groups as a storage pool for libvirt: http://ailoo.net/2011/02/use-a-lvm-volume-group-with-libvirt/ For a general introduction of the storage management in libvirt, please check: http://libvirt.org/storage.html
Find broken links on my site
Posted onThere are lots internal and external links on my site. Unfortunately, some of them are broken over years. How to find out all these broken links on my site? I use this tool http://www.brokenlinkcheck.com/ which can detect the broken links well. More info here: Broken links checker for sites
How to use different keys for different git servers?
Posted onI have access to different git servers. I have several keys for these servers. How to use different keys for different git servers? Use the .ssh/config file to specify different configuration for different SSH servers used by git: For example: Host git.example.org Port 22111 IdentityFile ~/.ssh/id_rsa.git.example.org Host code.example.org Port 22 IdentityFile ~/.ssh/id_rsa.code.example.org which specifies the
Read more
How to find out which function causes Exception “Stack_overflow” in OCaml
Posted onMy OCaml program prints: Fetal error: Exception “Stack_overflow” without any further information. How to find out which function causes this “Stack_overflow” exception? First, recompile your OCaml program with -g. Second, rerun your OCaml program with OCAMLRUNPARAM=b and the backtrace will be printed out after the “Stack_overflow” exception.