All commands (12,656)

  • Do you have an entire album in a unique file and want to split it in individual tracks? If you also have the cue file you can do it! Packages for Debian-based systems users: * cuetools shntool * FLAC (.flac): flac * WavPack (.wv): wavpack * Monkey's Audio (.ape): libmac2 monkeys-audio (deb http://www.debian-multimedia.org sid main) NOTE: "sid" packages are unstable, but I didn't have problems with them. If you prefer, use the "stable" version repository. To transfer the tags, you can use this (works with .flac, .ogg and .mp3): cuetag sample.cue split-track*.flac Show Sample Output


    5
    cuebreakpoints <cue file> | shnsplit -o <lossless audio type> <audio file>
    cammarin · 2009-04-29 10:42:57 0
  • The title is optional. Options: -t: expire time in milliseconds. -u: urgency (low, normal, critical). -i: icon path. On Debian-based systems you may need to install the 'libnotify-bin' package. Useful to advise when a wget download or a simulation ends. Example: wget URL ; notify-send "Done"


    47
    notify-send ["<title>"] "<body>"
    cammarin · 2009-04-29 10:05:20 5
  • txt2regex can be interactive or noninteractive and generates regular expressions for a variety of dialects based on user input. In interactive mode, the regex string builds as you select menu options. The sample output here is from noninteractive mode, try running it standalone and see for yourself. It's written in bash and is available as the 'txt2regex' package at least under debian/ubuntu. Show Sample Output


    8
    txt2regex
    bwoodacre · 2009-04-29 04:00:22 4
  • You've opened a terminal window and you've connected off to a remote host that didn't pick up your terminal size, and all your curses and paging apps are screwed up as a result. You need to quickly determine how many lines are in your current terminal view (to feed into "stty rows X"). Show Sample Output


    -2
    _llines=100; while [ $_llines -gt 1 ]; do echo $_llines; _llines=$(($_llines-1)); done
    romulusnr · 2009-04-29 00:19:45 3
  • Useful for switching over someone else's coding style who uses camelCase notation to your style using all lowercase with underscores. Show Sample Output


    11
    sed -r 's/([a-z]+)([A-Z][a-z]+)/\1_\l\2/g' file.txt
    atoponce · 2009-04-28 22:44:45 9
  • Clone linux installation.


    1
    find . -path ./mnt -prune -o -path ./lost+found -prune -o -path ./sys -prune -o -path ./proc -prune -o -print | cpio -pumd /destination && mkdir /destination/mnt/ && mkdir /destination/proc && mkdir /destination/sys
    nutria · 2009-04-28 22:14:45 3
  • Copy every file from current directory to destination preserving modification time.


    3
    find . | cpio -pumdv /destination
    nutria · 2009-04-28 22:08:30 5
  • From screen's manpage: "Attach here and now. In detail this means: If a session is running, then reattach. If necessary detach and logout remotely first. If it was not running create it and notify the user. This is the author's favorite." Toss this in your ~/.bash_profile so that you never have that "oh crap" moment where you wanted to run something in screen and didn't.


    11
    echo "screen -DR" >> ~/.bash_profile
    sud0er · 2009-04-28 20:45:37 0
  • GNU shred is provided by the coreutils package on most Linux distribution (meaning, you probably have it installed already), and is capable of wiping a device to DoD standards. You can give shred any file to destroy, be it your shell history or a block device file (/dev/hdX, for IDE hard drive X, for example). Shred will overwrite the target 25 times by default, but 3 is enough to prevent most recovery, and 7 passes is enough for the US Department of Defense. Use the -n flag to specify the number of passes, and man shred for even more secure erasing fun. Note that shredding your shell history may not be terribly effective on devices with journaling filesystems, RAID copies or snapshot copies, but if you're wiping a single disk, none of that is a concern. Also, it takes quite a while :)


    5
    shred targetfile
    sud0er · 2009-04-28 19:57:43 5

  • -3
    sudo pmset -a hibernatemode 1
    therod · 2009-04-28 19:53:57 0
  • Installing most OSX apps is just a matter of dropping it in /Applications, either GUI-wise or with cp -r. However, many packages are distributed in "mpkg" format, and those have to be installed with an installer. If you don't want to go to the trouble of firing up VNC to install an mpkg, you can use the "installer" command. This will install an application from a .mpkg it to /Applications system-wide. To install a program for just one user, replace "-target /" with "-target username".


    4
    sudo installer -pkg /Volumes/someapp/someapp.mpkg -target /
    sud0er · 2009-04-28 19:43:56 1
  • To unmount, replace "attach" with "eject"


    5
    hdiutil attach somefile.dmg
    sud0er · 2009-04-28 19:41:42 0
  • This will, for an application that has already been removed but had its configuration left behind, purge that configuration from the system. To test it out first, you can remove the last -y, and it will show you what it will purge without actually doing it. I mean it never hurts to check first, "just in case." ;)


    -3
    dpkg-query -l| grep -v "ii " | grep "rc " | awk '{print $2" "}' | tr -d "\n" | xargs aptitude purge -y
    thepicard · 2009-04-28 19:25:53 3
  • So you keep getting buzzes sounding from pidgin but you can't remember which buddy pounce is causing the beep. Well, cat/edit the ~/.purple/pounces and find out!


    0
    vim ~/.purple/pounces.xml
    linuxrawkstar · 2009-04-28 19:11:39 0
  • A powerfull way to rename file using sed groups. & stand for the matched expression. \1 referes to the first group between parenthesis. \2 to the second. Show Sample Output


    6
    ls | sed -n -r 's/banana_(.*)_([0-9]*).asc/mv & banana_\2_\1.asc/gp' | sh
    log0 · 2009-04-28 17:53:58 0

  • 1
    routel
    servermanaged · 2009-04-28 12:49:48 2
  • Start screen in detached mode, i.e., already running on background. The command is optional, but what is the purpose on start a blank screen process that way? It's useful when invoking from a script (I manage to run many wget downloads in parallel, for example).


    16
    screen -d -m [<command>]
    cammarin · 2009-04-28 12:35:25 6
  • Sometimes Firefox crashes or is bad finished and the message the process is still running appear while it's not. This also works when you sharing account from a NIS server and try to open the browser on multiple computers.


    7
    rm ~/.mozilla/firefox/<profile_dir>/.parentlock
    cammarin · 2009-04-28 12:15:58 1
  • Use the lshw command to display information about your video card. Give more ouput when run as root. Show Sample Output


    -1
    lshw -C display
    gwir · 2009-04-28 11:49:08 1
  • Purge all configuration files of removed packages Show Sample Output


    13
    sudo aptitude purge `dpkg --get-selections | grep deinstall | awk '{print $1}'`
    kelevra · 2009-04-28 11:44:04 5
  • A short way to give us relevant report in a moment done about quantities on disk usage, memory and swap in our Linux Systems. Show Sample Output


    -9
    alias dfr='df;free'
    ximo88 · 2009-04-28 11:30:31 0
  • typing history it's a long way but typing only h it's my way it works in whatever distro or OSes or shells that you use, you know, only for easyness :) Show Sample Output


    -8
    alias h='history'
    ximo88 · 2009-04-28 11:20:03 0
  • Useful for removes a package and its depends, for example to remove the gnome desktop environment, also configuration files will be removed, you should be carefully and sure that you want to do this. Show Sample Output


    -4
    sudo apt-get remove --purge `dpkg -l | awk '{print $2}' | grep gnome` && apt-get autoremove
    kelevra · 2009-04-28 10:34:42 7
  • Displays only the VGA adapter/chipset being used for the graphics. In this case, it gave me the "M22" and "Mobility Radeon x300" that I needed to research a graphics issue I was having. Show Sample Output


    1
    lspci |grep VGA
    CafeNinja · 2009-04-28 08:34:42 0
  • This is useful if you have need to do port forwarding and your router doesn't assign static IPs, you can add it to a script in a cron job that checks if you IP as recently changed or with a trigger script. This was tested on Mac OSX.


    9
    ifconfig en1 | awk '/inet / {print $2}' | mail -s "hello world" email@email.com
    rez0r · 2009-04-28 06:01:52 4
  • ‹ First  < 438 439 440 441 442 >  Last ›

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



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: