Commands using bash (57)

  • * in bash-shell You can capture the current commandline to a text-editor: * simply press: CTRL+x+e * Your current commandline will pe put into Your default text-editor (export EDITOR=vim)


    20
    bash-hotkey: <CTRL+x+e>
    alvinx · 2009-08-25 09:08:54 4
  • Simple command to convert a large number of images into jpeg-format. Will delete originals after conversion.


    4
    find . -name '*'.tiff -exec bash -c "mogrify -format jpg -quality 85 -resize 75% {} && rm {}" \;
    erlebnishengst · 2009-08-10 18:27:10 1
  • I used this because I needed to sort the content of a bunch of gzipped log files. Replace sort with something else, or simply remove sort to just rezip everything


    -2
    find . -name "*.gz" | xargs -n 1 -I {} bash -c "gunzip -c {} | sort | gzip -c --best > {}.new ; rm {} ; mv {}.new {}"
    kennethjor · 2009-08-05 14:16:15 4

  • 4
    bash -x script.sh 2> log
    climatewarrior · 2009-06-08 19:31:51 1
  • Display commands and their arguments as they are executed. Useful for debugging shell scripts. Show Sample Output


    3
    bash -x SCRIPT
    jcalvert · 2009-03-13 00:09:07 3

  • 25
    bash -x ./post_to_commandlinefu.sh
    nottings · 2009-02-25 19:10:21 7
  • In the sample output, I pressed ctrl+r and typed the letters las. I can't imagine how much typing this has saved me. Show Sample Output


    15
    ^r in bash begins a reverse-search-history with command completion
    abcde · 2009-02-19 18:17:54 2
  •  < 1 2 3

What's this?

commandlinefu.com 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

Make vim open in tabs by default (save to .profile)
I always add this to my .profile rc so I can do things like: "vim *.c" and the files are opened in tabs.

Clear current session history (bash)

Burn CD/DVD from an iso, eject disc when finished.
cdrecord -scanbus will tell you the (x,y,z) value of your cdr (for example, mine is 3,0,0)

Execute a command at a given time
This is an alternative to cron which allows a one-off task to be scheduled for a certain time.

list files recursively by size

list block devices
Shows all block devices in a tree with descruptions of what they are.

Convert .wma files to .ogg with ffmpeg

Get Dell Service Tag Number from a Dell Machine
This will give you the Dell Service tag number associated with your machine. Incredibly useful when you need that number for tech support or downloads.

Find the package that installed a command

check open ports without netstat or lsof


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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: