``vimhtml somefile.txt`` will open vim for the HTML convertion and close it immediately after its done, leaving you with somefile.html which you can later use in your website or whatever.
Especially for sysadmins when they don't want to waste time to add -p flag on the N processes of a processname.
In the old school, you did ;
pgrep processname
and typing strace -f -p 456 -p 678 -p 974...
You can add -f argument to the function. That way, the function will deal with pgrep to match the command-line.
Example :
processname -f jrockit
gorecord foo.mp4
I've tried all of the screen recorders available for Linux and this is easily the best. xvidcap segfaults; VNC is too much hassle. There are alternatives of this command already here that I am just too lazy to reply to. Messing with the frames per second option, -r, 25 seems to be the best. Any lower and the video will look like a flipbook, if it records at all - -r 10 won't - any faster is the same, oddly enough.
Edit: CLF doesn't like my long command to add audio, so here it is in the description.
goaddaudio()
{
if [ $# != 3 ]; then
echo 'goaddaudio < audio > < src video > < dst video >'
return
fi
f=goaddaudio$RANDOM
ffmpeg -i "$2" &> $f
d=$( grep Duration $f | awk '{print $2}' | tr -d ',' ) &&
rm $f &&
ffmpeg -i "$1" -i "$2" -r 25 -ab 192k -ar 44100 -sameq -t $d "$3"
}
This allows for sleeping in between pings. Also, espeak needs to be installed.
This function returns TRUE if the application supports tcp-wrapping or FALSE if not by reading the shared libraries used by this application. Show Sample Output
Shell function; returns 0 if the port is up, 1 otherwise (check $? after executing). First parameter: IP address/hostname Second parameter: port number There is no error checking for the input parameters.
This saves Subversion's log output as XML and then runs an XQuery over it. This is standard XQuery 1.0 and should therefore also work with other XQuery processors. I have tested it with Zorba (http://www.zorba-xquery.com). XQilla (http://xqilla.sourceforge.net) also does it, but you'd have to save the query to a file and then execute "xqilla filename.xq". The query first finds all distinct authors and then, for each author, sums up the number of paths they have changed in each commit. This accounts for commits of multiple changes at once. The indenting space in all lines from the second one seems to be due to a bug in Zorba. Show Sample Output
When processing IP addresses in the shell (or shell script) it is useful to be able to verify that the value of data is an IP address (an not some random string or non-sensible IP address). Show Sample Output
This command will automate the creation of ESSIDs and batch processing in pyrit. Give it a list of WPA/WPA2 access points you're targeting and it'll import those ESSIDs and pre-compute the potential password hashes for you, assuming you've got a list of passwords already imported using:
pyrit -i dictionary import_passwords
Once the command finishes, point pyrit to your packet capture containing a handshake with the attack_db module. Game over.
Show Sample Output
ksh's version of cd has an optional syntax where you can type "cd old new" and it will replace "old" with "new" in your current directory and take you there. This is very handy when you have a parallel directory structure, like source and object directories. As suggested, you can just type cd ${PWD/old/new} to get this in bash, but this function in your .bashrc will let you type the ksh cd syntax and avoid typing the special characters while preserving other cd functionality. Show Sample Output
allows command to use switches
usage: alarmclock TIME TIME is a sleep(1) parameter which tells function how long to wait until raise the alarm.
Pass the files path to finfo(), can be unix path, dos path, relative or absolute. The file is converted into an absolute nix path, then checked to see if it is in-fact a regular/existing file. Then converted into an absolute windows path and sent to "wmic". Then magic, you have windows file details right in the terminal. Uses: cygwin, cygpath, sed, and awk. Needs Windows WMI "wmic.exe" to be operational. The output is corrected for easy...
finfo notepad.exe
finfo "C:\windows\system32\notepad.exe"
finfo /cygdrive/c/Windows/System32/notepad.exe
finfo "/cygdrive/c/Program Files/notepad.exe"
finfo ../notepad.exe
Show Sample Output
i'm using -x : -x, --one-file-system skip directories on different file systems so mounts points aren't walked trough Show Sample Output
This runs a command continuously, restarting it if it exits. Sort of a poor man's daemontools. Useful for running servers from the command line instead of inittab.
to test android app
This function is used to set environmental variables from a list of alternatives depending on what's installed on the system. It returns the first program found in the list.
Example usage:
export BROWSER=$(find_alternatives chromium-browser google-chrome opera firefox firefox-bin iceweasel konqueror w3m lynx)
.
export EDITOR=$(find_alternatives vim nano pico emacs kate)
.
export PAGER=$(find_alternatives vimpager less most more pg)
It is not easy to make perl give a segfault, but this does it. This is a known issue but apparently not easy to fix. This is completely useless except for showing people that perl is not bullet-proof. Show Sample Output
Useful in while and if statements
if not grep string filename; then echo string not found; exit 1; fi
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.
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: