commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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
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:
Show file count into directories.
Usefull when you try to find hugh directories that elevate system CPU (vmstat -> sy)
you can use any common video format. if you don't need to change the size of gif output, just remove `-vf scale=320:-1`
btw, 320:-1 means width is 320px and height would be set automatically
This causes computer to never power off or go into sleep mode. Disables sleep mode linux.
This will grab the controlling tty regardless of what STDOUT and STDERR are doing.
Tests to see if stdin (0) is NOT a terminal.
Tests to see if stdout (1) IS a terminal.
Copies stdout (opened for write) to stdin (open for read).
Uses soxi instead of mplayer
Use `security list-keychains` to find possible keychains, and `security dump-keychain` to look for certificates.
`sudo security delete-certificate` without arguments shows options for removing: by common name or by SHA-1 hash.
This is especially useful if a certificate locks up Keychain Access.app, which happens for certificates with many SANs in macOS 10.12.
Found via: http://stackoverflow.com/a/16019443
Show the executable that spawned the process and show the PID and ORACLE_HOME relative to the environment within which the process is running.
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
Function to add a shebang to an existing script, handy if you forgot to add it in the first place.
This is a commodity one-liner that uses ShellCheck to assure some quality on bash and sh scripts under a specific directory. It ignores the files in .git directory.
Just substitute "./.git/*" with "./.svn/*" for older and booring centralized version control.
Just substitute ShellCheck with "rm" if your scripts are crap and you want to get rid of them :)
Usage:
videospeed video_filename speedchange newfilename
videospeed foo.mp4 0.5 foo_slow.mp4
Range of 0.5 (50%) - 2.0 (200%) is valid.
Uses parallel processing
Reiteration of my earlier command
https://www.commandlinefu.com/commands/view/15246/convert-entire-music-library
Usage
lc Old_Directory New_DIrectory Old_Format New_Format
lc ~/Music ~/Music_ogg mp3 ogg
Uses the pv utility to show progress of data transfer and an ETA until completion.
You can install pv via Homebrew on macOS