Commands by zed (11)

  • Change the value of p to match the path where you wish to create the profile. To run it again in the future, use the parameter --user-data-dir (which gets echoed to you when run): chromium-browser --user-data-dir=/path/to/your/ Quick Functions: # create a new chromium profile new-chromium-profile() { p=~/.config/chromium/$1; cp -r ~/.config/chromium/Default $p && echo "chromium-browser --user-data-dir=$p" && chromium-browser --user-data-dir=$p; } # runs a chromium profile run-chromium-profile() { chromium-browser --user-data-dir=~/.config/chromium/$1; } Show Sample Output

    p=~/.config/chromium/zed; cp -r ~/.config/chromium/Default $p && echo "chromium-browser --user-data-dir=$p" && chromium-browser --user-data-dir=$p;
    zed · 2010-11-08 02:45:29 0
  • Create a progress dialog with custom title and text using zenity. Show Sample Output

    for i in $(seq 0 5 100); do echo $i; sleep 1; done | zenity --progress --title "Installing Foobar" --text "Pleae wait until process has finished."
    zed · 2010-10-08 04:08:33 0
  • using seq inside a subshell instead of a bash sequence to create increments. Show Sample Output

    for i in $(seq 0 5 100); do echo $i; sleep 1; done | dialog --gauge "Install..." 6 40
    zed · 2010-10-08 04:08:17 0
  • A more robust password creation utility # Create passwords in batch makepasswd --char=32 --count=10 # To learn more about the options you can use man makepasswd Show Sample Output

    makepasswd --char=32
    zed · 2010-09-29 06:01:32 0
  • Changes your desktop background image in gnome. Update the directory to wherever you keep your wallpapers. I like to create a sub-directory in my Wallpaper folder called "cycle" that I use to define the wallpapers I wish to loop in cron. ex: gconftool-2 -t str -s /desktop/gnome/background/picture_filename "$(find ~/Wallpapers/cycle -type f | shuf -n1)" Show Sample Output

    gconftool-2 -t str -s /desktop/gnome/background/picture_filename "$(find ~/Wallpapers -type f | shuf -n1)"
    zed · 2010-09-21 04:01:55 0
  • Take a screenshot of the focused window with a 4 second countdown # shorten by adding to your .bashrc: alias sss='scrot -ucd4 && eog $(ls -tr | tail -n1)' echo -e "\nalias sss='scrot -ucd4 && eog $(ls -tr | tail -n1)'" >> ~/.bashrc -d 4 second delay -c display countdown -u focused window man scrot for more flags Show Sample Output

    scrot -ucd4 -e 'eog $f'
    zed · 2010-09-15 03:31:06 4
  • requires "youtube-dl" -- sure you can do this with wget and some more obscurity but why waste your time when this great tool is available? the guts consist of mplayer converting a video to a gif -- study this command and read the man page for more information mplayer video.flv -ss 00:23 -endpos 6 -vo gif89a:fps=5:output=output.gif -vf scale=400:300 -nosound generates a 6 second gif starting at 23 seconds of play time at 5 fps and a scale of 400x300 start time (-ss)/end time (-endpos) formats: 00:00:00.000 end time should be relative to start time, not absolute. i.e. -endpos 5 == seconds after 0:42 = 0:47 end point play with fps and scale for lower gif sizes the subshell is a solution for the -b flag on youtube-dl which downloads the best quality video, sometimes, which can be various video formats $(ls ${url##*=}*| tail -n1) Show Sample Output

    url=; youtube-dl -b $url; mplayer $(ls ${url##*=}*| tail -n1) -ss 00:57 -endpos 10 -vo gif89a:fps=5:output=output.gif -vf scale=400:300 -nosound
    zed · 2010-07-18 02:11:39 15
  • The above is an example of grabbing only the first column. You can define the start and end points specifically by chacater position using the following command: while read l; do echo ${l:10:40}; done < three-column-list.txt > column-c10-c40.txt Of course, it doesn't have to be a column, or extraction, it can be replacement while read l; do echo ${l/foo/bar}; done < list-with-foo.txt > list-with-bar.txt Read more about parameter expansion here: Think of this as an alternative to awk or sed for file operations

    while read l; do echo ${l%% *}; done < three-column-list.txt > only-first-column.txt
    zed · 2010-07-09 03:42:56 0
  • The above is just a prove of concept based around the nested bash substitution. This could be useful in situations where you're in a directory with many filetypes but you only want to convert a few. for f in *.bmp *.jpg *.tga; do convert $f ${f%.*}.png; done or you can use ls | egrep to get more specific... but be warned, files with spaces will cause a ruckus with expansion but the bash for loop uses a space delimited list. for f in $(ls | egrep "bmp$|jpg$|tga$"); do convert $f ${f%.*}.png; done I'm guessing some people will still prefer doing it the sed way but I thought the concept of this one was pretty neat. It will help me remember bash substitutions a little better :-P Show Sample Output

    for f in t1.bmp t2.jpg t3.tga; do echo ${f%.*}.png; done
    zed · 2010-07-09 00:38:53 0
  • You need to have fortune and cowsay installed. It uses a subshell to list cow files in you cow directory (this folder is default for debian based systems, others might use another folder). you can add it to your .bashrc file to have it great you with something interesting every time you start a new session. Show Sample Output

    fortune | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf -n1)
    zed · 2010-07-08 02:57:52 2
  • This will be seen through your system's visual notification system, notify-osd, notification-daemon, etc. --- sleep accepts s,m,h,d and floats (date; sleep .25m; date) --- notify-send (-t is in milliseconds && -u low / normal / critical) man notify-send for more information --- notification-daemon can use b/i/u/a HTML

    sleep 6s && notify-send -t 10000 -u critical "remember to think" &
    zed · 2010-07-01 02:17:24 3

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

Check if a web page has changed last time checked.
Checks if a web page has changed. Put it into cron to check periodically. Change and for your needs.

cd to (or operate on) a file across parallel directories
This is useful for quickly jumping around branches in a file system, or operating on a parellel file. This is tested in bash. cd to (substitute in PWD, a for b) where PWD is the bash environmental variable for the "working directory"

exec chmod to subfiles
Using `-exec cmd {} +` causes find to build the command using all matching filenames before execution, rather than once per file.

Keep a copy of the raw Youtube FLV,MP4,etc stored in /tmp/
Certain Flash video players (e.g. Youtube) write their video streams to disk in /tmp/ , but the files are unlinked. i.e. the player creates the file and then immediately deletes the filename (unlinking files in this way makes it hard to find them, and/or ensures their cleanup if the browser or plugin should crash etc.) But as long as the flash plugin's process runs, a file descriptor remains in its /proc/ hierarchy, from which we (and the player) still have access to the file. The method above worked nicely for me when I had 50 tabs open with Youtube videos and didn't want to have to re-download them all with some tool.

Find broken symlinks in the current directory and its subdirectories.
This is best run as root to avoid permission denials that can produce false positives. Obviously you can specify a directory in the usual way: $ find -L dirname -type l I can't remember where I read about this or who deserves the credit for it. The find(1) manual page hints strongly toward it, however.

Outputs a 10-digit random number

archlinux: shows list of packages that are no longer needed
Shows a list of packages which are no longer needed as dependencies of any package installed on your system.

Display the size of all your home's directories
Display the size (human reading) of all the directories in your home path (~).

geoip information
Not my script. Belongs to mathewbauer. Used without his permission. This script gives a single line as shown in the sample output. NOTE: I have blanked out the IP address for obvious security reasons. But you will get whatever is your IP if you run the script. Tested working in bash.

Detect illegal access to kernel space, potentially useful for Meltdown detection
Based on capsule8 agent examples, not rigorously tested

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: