Commands tagged organize (1)

  • It happened to me that I got a season of a tv-show which had all files under the same folder like /home/blah/tv_show/season1/file{1,2,3,4,5,...}.avi But I like to have them like this: /home/blah/tv_show/season1/e{1,2,3,4,5,...}/file{1,2,3,4,5,...}.avi So I can have both the srt and the avi on one folder without cluttering much. This command organizes everything assuming that the filename contains Exx where xx is the number of the episode. You may need to set: IFS=$'\n' if your filenames have spaces.

    season=1; for file in $(ls) ; do dir=$(echo $file | sed 's/.*S0$season\(E[0-9]\{2\}\).*/\1/'); mkdir $dir ; mv $file $dir; done
    lonecat · 2009-05-27 03:30:58 0

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 NFL/MLB Scores/Time
change the nfl in the url to mlb or nba to get those score/times as well

Force the script to be started as root
Place this code at the beginning of your script to ensure that it can only be executed by the root.

convert vdi to vmdk (virtualbox hard disk conversion to vmware hard disk format)
Converts a .vdi file to a .vmdk file for use in a vmware virtual machine. The benefit: using this method actually works. There are others out there that claim to give you a working .vmdk by simply using the qemu-img command alone. Doing that only results in pain for you because the .vmdk file will be created with no errors, but it won't boot either. Be advised that these conversions are very disk-intensive by nature; you are probably dealing with disk images several gigabytes in size. Once finished, the process of using the new .vmdk file is left as an exercise to the reader.

Dump root ext3 fs over ssh
...can do similar w/ tar, dd, xfsdump, e2fsdump, etc.

check open ports without netstat or lsof

Go (cd) directly into a new temp folder
This command create a new temp directory using mktemp (to avoid collisions) and change the current working directory to the created directory.

Lists architecture of installed RPMs
Lists all installed RPM packages with name and architecture, which is useful to check for compability packages (+ required i386 packages) on a 64bit system.

Output as many input
Output of a command as input to many

Compute the average number of KB per file for each dir
Shorter version using --tag

Remind yourself to leave in 15 minutes
If you spend most of your time in front of the terminal, leave is a useful reminder. Leave can have absolute form: leave 1555 reminds you to leave at 3:55PM

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: