LinuxShort
From MediaWiki
(Difference between revisions)
m (→Usefull short commands) |
m (→Usefull short commands) |
||
Line 50: | Line 50: | ||
* '''Resize image''' | * '''Resize image''' | ||
- | mogrify -trim -resize 70% image.jpg | + | mogrify -trim -resize 70% image.jpg # or ''-resize 800x600'' |
== Some cool stuff == | == Some cool stuff == |
Revision as of 11:42, 22 November 2010
Usefull short commands
- kill a process tree
When some script is started from a command line in a for-loop and a process tree is made, one should find the parent process and its PID and then simply kill it:
$ pstree username -p sshd(19953)---bash(19954)---bash(22238)---idl(22323)-+-{idl}(22326) |-{idl}(22327) |-{idl}(22328) `-{idl}(22329) sshd(20096)---bash(20097) sshd(20762)---bash(20763) sshd(21087)---bash(21088)-+-grep(21309) `-top(21308) sshd(21736)---bash(21737) sshd(21780)---bash(21781)---pstree(22331)
Or if this tree is to long, one should grep the program (here:idl) with: $ pstree usrname -p | grep idl
$ kill 19953 $ pstree username -p sshd(20096)---bash(20097) sshd(20762)---bash(20763) sshd(21087)---bash(21088)-+-grep(21309) `-top(21308) sshd(21736)---bash(21737) sshd(21780)---bash(21781)---pstree(22332)
- Change sth inside file
sed -i s/'\-9999'/'NaN'/g filename
This will change -9999 with NaN inside a file, without making some tmp file in between.
- Print rotated picture
lp -o media=a4 -o orientation-requested=4 -o fitplot figure.ps
- Print in fixed width format with awk
echo $a $b $c | awk '{for (i=1; i<=NF; i++) printf("%-20s ",$i);printf ("\n")}' > outfile.dat
where strings a,b,c may be entire lines.
- Make a small size pdf out of several pdfs
gs -dNOPAUSE -q -dBATCH -sDEVICE=pdfwrite -sOutputFile=MajorFile.pdf SmallFiles*.pdf
- Convert eps to jpg using native gs
gs -sDEVICE=jpeg -dJPEGQ=80 -dNOPAUSE -dBATCH -dSAFER -r100 -sOutputFile=image.jpg image.eps # -r100 should be changed to -r50 for denser image
- Resize image
mogrify -trim -resize 70% image.jpg # or -resize 800x600
Some cool stuff
- Very nice themes for Ubuntu 10.04
sudo add-apt-repository ppa:bisigi sudo aptitude update sudo aptitude install bisigi-themes