Handy command line utilities and other stuff
Tuesday, April 14, 2009 at 8:27PM
Drew

 

Every once in a while I find a command that I could have used a couple of days ago. You know the one. Remember that time when you were trying to do something like killing a process or unmounting a stubborn usb drive? That is what I'm talking about. Whenever I find myself needing these commands I can never find where I have written them down or what file I saved them to. So I though I would create a page where I can store them. I know other sites have more of the same thing but I think this page may end up being more of a notepad for me than a place to share. Anyway, I hope you find some of them as usefull as I have.

Eject a sutbborn usb drive or mounted folder.

fuser -k /media/Path-to-mounted-directory/

Enable Ctrl+Alt+Backspace in Jaunty Jackalope (disabled in the alpha)

dontzap --disable

Create a session that will output all of your commands to a text file. This will save the session to a file called "typescript" in your home directory

script <enter> Type "exit" to end session

To find a running process type

jobs

To kill the process type

kill %1 or kill %<job-number>

Want to see who you are connected to? (you may have to install iproute)

ss -r

Record a screencast and save it as an mpeg


ffmpeg -f x11grab -s 800x600 -i :0.0 /tmp/screencast.mpg

Shutdown a windows pc from a linux pc

(courtesy of shell-fu.org)

http://www.shell-fu.org/lister.php?id=839

Start a webserver serving the directory you are currently in.

python -m SimpleHTTPServer

 

 

How to stream mp3 files to a remote machine.

  (The command on the client must be run first. If not it will just give an error.)

On the client/listening side do

nc -lp 1234 | mplayer -

And on the server/sender side do

cat <name of mp3 file.mp3> | nc <ipaddress of remote pc> 1234

 

Article originally appeared on MyBrainRunsLinux.com (http://mybrainrunslinux.squarespace.com/).
See website for complete article licensing information.