### Commands by zombiedeity (2) the last day the last week the last month all time sorted by date votes

• To ensure that it will never come back, you can edit /etc/modprobe.d/blacklist Add "blacklist pcspkr" sans quotes

8
sudo rmmod pcspkr
· 2009-07-17 18:21:19
• Replace (as opposed to insert) hex opcodes, data, breakpoints, etc. without opening a hex editor. HEXBYTES contains the hex you want to inject in ascii form (e.g. 31c0) OFFSET is the hex offset (e.g. 49cf) into the binary FILE

2
echo -n $HEXBYTES | xxd -r -p | dd of=$FILE seek=$((0x$OFFSET)) bs=1 conv=notrunc
· 2009-03-11 17:02:24

### 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.

### Check These Out

Store dirs to later be changed to independant of the last directory you were in. Also with managment tools.
Check out: help dirs help pushd help popd -- Cheers!

Import SQL into MySQL with a progress meter
This uses PV to monitor the progress of the MySQL import and displays it though Zenity. You could also do this pv ~/database.sql | mysql -u root -pPASSWORD -D database_name and get a display in the CLI that looks like this 2.19MB 0:00:06 [ 160kB/s] [> ] 5% ETA 0:01:40 My Nautalus script using this command is here http://www.daniweb.com/forums/post1253285.html#post1253285

clear MyDNS-ng cache
Occasionally, to force zone updating, cache flush is necessary. This command is better than restart the mydns daemon.

An alias to re-run last command with sudo. Similar to "sudo !!"
I didn't come up with this myself, but I always add this to my .bash_aliases file. It's essentially the same idea as running "sudo !!" except it's much easier to type. (You can't just alias "sudo !!", it doesn't really work for reasons I don't understand.) "fc" is a shell built-in for editing and re-running previous commands. The -l flag tells it to display the line rather than edit it, and the -n command tells it to omit the line number. -1 tells it to print the previous line. For more detail: $help fc Simple word scramble enlubtsqyuse$ cat /tmp/out subsequently

Convert seconds to [DD:][HH:]MM:SS
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" }

resolve short urls
since the most url shorteners respond with a header containing the Location: ... this works with most common shorteners

escape any command aliases
e.g. if rm is aliased for 'rm -i', you can escape the alias by prepending a backslash: rm [file] # WILL prompt for confirmation per the alias \rm [file] # will NOT prompt for confirmation per the default behavior of the command

List all process running a specfic port
List all process running a specfic port

check open ports without netstat or lsof