Commands tagged cal (6)

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

get diskusage of files modified during the last n days
get diskusage of files (in this case logfiles in /var/log) modified during the last n days: $ sudo find /var/log/ -mtime -n -type f | xargs du -ch n -> last modified n*24 hours ago Numeric arguments can be specified as +n for greater than n, -n for less than n, n for exactly n. => so 7*24 hours (about 7 days) is -7 $ sudo find /var/log/ -mtime -7 -type f | xargs du -ch | tail -n1

Create a random file of a specific size
This will create a 10 MB file named testfile.txt. Change the count parameter to change the size of the file. As one commenter pointed out, yes /dev/random can be used, but the content doesn't matter if you just need a file of a specific size for testing purposes, which is why I used /dev/zero. The file size is what matters, not the content. It's 10 MB either way. "Random" just referred to "any file - content not specific"

Launch firefox on a remote linux server
Actually 'firefox' is a script that then launches the 'firefox-bin' executable. You need to specify the 'no-remote' option in order to launch remote firefox instead of your local one (this drove me crazy time ago)

create disk copy over the net without temp files
I wanted to create a copy of my whole laptop disk on an lvm disk of the same size. First I created the logical volume: lvcreate -L120G -nlaptop mylvms SOURCE: dd if=/dev/sda bs=16065b | netcat ip-target 1234 TARGET: nc -l -p 1234 | dd of=/dev/mapper/mylvms-laptop bs=16065b to follow its process you issue the following command in a different terminal STATS: on target in a different terminal: watch -n60 -- kill -USR1 $(pgrep dd) (see

Show CPU usage for EACH cores

Write comments to your history.
A null operation with the name 'comment', allowing comments to be written to HISTFILE. Prepending '#' to a command will *not* write the command to the history file, although it will be available for the current session, thus '#' is not useful for keeping track of comments past the current session.

guitar synthesizer in one line of C
outputs a f=220Hz guitar string sound (fifth string A) needs ALSA

Pretty-print user/group info for a given user

Query Wikipedia via console over DNS

pid of manually selecting window

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: