All commands (4)

  • sometimes I need list from path with max limit for recursive depth directory listing

    tree -L 2 -u -g -p -d
    aysadk · 2020-11-04 10:45:39 12
  • Use this command if you want to rename all subtitles for them to have the same name as the mp4 files. NOTE: The order of "ls -1 *.mp4" must match the order of "ls -1 *.srt", run the command bellow to make sure the *.srt files will really match the movies after run this command: paste -d:

    paste -d: <(ls -1 *.mp4) <(ls -1 *.srt) | while read line; do movie="${line%%:*}"; subtitle="${line##*:}"; mv "${subtitle}" "${movie%.*}.srt"; done
    ricardofunke · 2020-11-08 02:47:13 22
  • This script finds all git objects and `git cat-file`'s their content. This is really just a helper function to play around with the internals of git repositories. See of more info. Show Sample Output

    find .git/objects/ -type f \| sed 's/\.git\/objects\/\///' | sed 's/\///g' | xargs -n1 -I% echo echo "%" \$\(git cat-file -p "%"\) \0 | xargs -n1 -0 sh -c
    wires · 2020-11-15 09:24:58 8
  • if you want to move with command mv large list of files than you would get following error /bin/mv: Argument list too long alternavite with exec: find /source/directory -mindepth 1 -maxdepth 1 -name '*' -exec mv {} /target/directory \; Show Sample Output

    find /source/directory -mindepth 1 -maxdepth 1 -name '*' -print0 | xargs -0 mv -t /target/directory;
    aysadk · 2020-11-17 12:30:45 9

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

Convert a date to timestamp
Simple way to get a timestamp from a date

Create a persistent connection to a machine
Create a persistent SSH connection to the host in the background. Combine this with settings in your ~/.ssh/config: Host host ControlPath ~/.ssh/master-%[email protected]%h:%p ControlMaster no All the SSH connections to the machine will then go through the persisten SSH socket. This is very useful if you are using SSH to synchronize files (using rsync/sftp/cvs/svn) on a regular basis because it won't create a new socket each time to open an ssh connection.

Short Information about loaded kernel modules
Liked command 4077 so I improved it, by doing all text manipulation with sed. "Run this as root, it will be helpful to quickly get information about the loaded kernel modules." THX mohan43u

Squish repeated delimiters into one
This can be particularly useful used in conjunction with a following cut command like $echo "hello::::there" | tr -s ':' | cut -d':' -f2 which prints 'there'. Much easier that guessing at -f values for cut. I know 'tr -s' is used in lots of commands here already but I just figured out the -s flag and thought it deserved to be highlighted :)

convert uppercase files to lowercase files

Juste a reminder that this works.
You can do some boolean logic like A or B then C else D using or : || and : && So you can do some : # false || false && echo true || echo false false # true || false && echo true || echo false true # false || true && echo true || echo false true # true || true && echo true || echo false true and so on ... I use it like : $(ssh 'test something') || $(ssh 'test something') && echo ok || echo ko

Disable annoying sound emanations from the PC speaker
To ensure that it will never come back, you can edit /etc/modprobe.d/blacklist Add "blacklist pcspkr" sans quotes

Convert a flv video file to avi using mencoder

Output sound when your computer is downloading something
Outputs pseudo-random sounds to speakers (stereo mode because of -c 2) when there are any kind of network activity.

Geolocate a given IP address

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: