User Tools

Site Tools


linuxutils

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
linuxutils [2008/05/24 17:12]
81.208.74.179
linuxutils [2008/05/24 22:20] (current)
88.66.8.195 old revision restored
Line 1: Line 1:
 +====== Useful Linux Utilities ======
  
 +
 +  * [[gpg]] options
 +
 +===== Useful tools with hard to remember names =====
 +
 +  * ''​scrot -s''​ -- takes screenshots of an area
 +  * generates passwords:
 +    - ''​apg -a 1 -m 6 -x 6''​
 +    - ''​pwgen''​
 +  * ''​figlet foo''​ -- creates an ASCII art formatted text
 +
 +
 +
 +===== Mrxvt =====
 +
 +[[http://​materm.sourceforge.net/​index.html|Mrxvt]] is a multitabbed terminal emulator based on RXVT. It doesn'​t require any heavy libraries like QT or GTK so it's ideal for a low powered laptop machine.
 +
 +Place this into your ''​~/​.Xdefaults''​ file for some nicer defaults.
 +
 +<​code>​
 +mrxvt.font: 9x15
 +mrxvt.geometry:​ 100x30
 +mrxvt.reverseVideo:​ True
 +mrxvt.loginShell:​ True
 +mrxvt.scrollbarRight:​ True
 +mrxvt.scrollbarStyle:​ rxvt
 +mrxvt.bottomTabbar:​ True
 +mrxvt.saveLines:​ 1500
 +mrxvt.visualBell:​ True
 +Mrxvt.macro.Shift+Left:​ GotoTab -1
 +Mrxvt.macro.Shift+Right:​ GotoTab +1
 +</​code>​
 +
 +Some tips:
 +
 +  * Change tab with ''​Shift+Right''​ and ''​Shift+Left''​
 +  * Open a new tab with ''​Shift+Ctrl+t''​
 +  * Change the title of a tab by marking some text and middle click the tab's name
 +  * Open multiple tabs at startup with ''​-tnum #''​ in command-line args
 +
 +===== SSH Port forwarding =====
 +
 +Forward the webserver (port 127.0.0.1:​80) at remote.host to your local machine (port 8080) and allow open this port (8080) on all local interfaces (-g):
 +
 +  $> ssh user@remote.host -L 8080:​127.0.0.1:​80 -N -g
 +
 +===== File Transfer through existing SSH connection =====
 +
 +Have you ever been logged into a machine (maybe even over multiple hosts) and then needed a file from you local host on that machine? Using a second connection with scp is a pain in the a** especially with multiple hops. The solution is [[http://​zssh.sourceforge.net/​|zssh]] - a wrapper around SSH and the zmodem protocol.
 +
 +On you local machine just install it (''​apt-get install zssh''​ is your friend) and probably add the following to your ''​~/​.bashrc''​
 +
 +  alias ssh=zssh
 +
 +When you are on the remote machine just press ''​CTRL-Space''​ to go into interactive mode (very much like FTP). To send a file use this:
 +
 +  sz -e <​file>​
 +
 +The ''​-e''​ option works around non 8-Bit clean terminals. You only need the ''​lrzsz''​ and ''​ssh''​ packages installed on the remote machine.
 +
 +===== vmstat =====
 +
 +Gives you some info about memory stats, IO and CPU states. Give sample rate in seconds as parameter.
 +
 +  #> vmstat 3
 +
 +===== dig =====
 +
 +This is a powerful replacement for ''​nslookup''​
 +
 +Doing a zone transfer if allowed:
 +
 +  $> dig @nameserver domain.tld axfr
 +
 +===== Unlocking a CD Writer with cdrdao =====
 +
 +If a write failes the writer stays inaccessable sometimes - giving an error like this:
 +
 +  logical unit not ready, long write in progress
 +
 +Resetting the SCSI or ATAPI bus doesn'​t help. The tool cdrdao has an option to reset the device properly:
 +
 +  #> cdrdao unlock
 +
 +
 +<​del>​===== Copy an audio CD with cdrdao =====</​del>​
 +Will use the recorder for reading and writing:
 +
 +  #> cdrdao copy --device 0,0,0 --driver generic-mmc --datafile /​exchange/​cd.img --eject
 +
 +===== Burn an ISO Image with cdrecord =====
 +
 +  #> cdrecord -v dev=0,0,0 speed=16 driveropts=burnfree image.iso
 +
 +===== VIM Setup in source file =====
 +
 +You can embed Setup Commands for VIM in the source file. Here is an example for a Shell Script:
 +
 +  #Setup VIM: ex: et ts=2 nowrap syntax=sh :
 +
 +===== pgrep and pkill =====
 +
 +From the [[man>​pgrep|manpage]]:​
 +
 +> pgrep  looks through the currently running processes and lists the process IDs which matches the selection criteria to stdout. ​ All the criteria have to match. ​ For example, ''​pgrep -u root sshd''​ will only list the processes called sshd AND owned by root.  On the other hand, ''​pgrep -u root,​daemon''​ will list the processes owned by root OR daemon.
 +>
 +> pkill will send the specified signal (by default SIGTERM) to each process instead of listing them on stdout.
 +
 +This is a nice replacement for constructions like ''​%%kill `ps ax|grep '​foo'​|grep -v '​grep'​|awk '​{print $1}'​`%%''​
 +
 +===== nast =====
 +
 +Sweet Network Analyzer (http://​nast.berlios.de/​) or just install the Debian Packages.
 +
 +I like the ''​-m''​ (map LAN via ARP requests) and the ''​-g''​ (find a gateway host) switches most.
 +
 +
 +===== iostat I/O Device Usage Informations =====
 +
 +This command-line tool is within the ''​sysstat''​-package and provides information about the cpu load/​usage ​  ​and/​or about basically any device in /dev/.
 +usage: iostat [device [device2..]] [refrehrate in sec] [repeats]
 +refrehsrate defaults to 0, means no repeats at all.
 +repeat defaults to infinite.
 +
 +
 +===== iptraf Network Load Informations =====
 +
 +This command-line tool displays package information and Usage of several network interfaces.
 +It has a console-graphical interface and serveral configuration options. See man-page.
 +
 +===== httrack Website Copier =====
 +
 +To fetch a whole site use this command:
 +
 +  $> httrack -K0 -%q0 --keep-alive --urlhack -D http://​www.example.com
 +
 +===== mplayer / mencoder =====
 +
 +This gives you the suggested crop parameters:
 +
 +  $> mplayer -vf cropdetect somemovie.avi
 +
 +
 +This concats two avi files
 +
 +  $> cat part1.avi part2.avi| mencoder -noidx -ovc copy -oac copy -o output.avi -
 +
 +For rotating MJPEG movies as produced by the [[PowerShot S2 IS]]. This is not completely lossless but the best way I could find:
 +
 +  $> mencoder -vf rotate=2 -ovc lavc -lavcopts vcodec=mjpeg -oac copy -o output.avi input.avi
linuxutils.txt ยท Last modified: 2008/05/24 22:20 by 88.66.8.195