
Terminal - All commands - 10,560 results
dd if=/dev/sdX of=/root/sdX.bin bs=1M count=1
This is sample output - yours may be different.
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.0718711 seconds, 14.6 MB/s
This will copy the first 1MB of your /dev/sdX volume to your /root/sdX.bin file, where SDX is the name of the device you wish to copy the data from (Usually a hard disk)
NOTE: Make sure you capitalize the M in field for BS.
git svn --authors-file=some-authors-file clone svn://address/of/svn/repo new-git-dir
This is sample output - yours may be different.
git diff HEAD..rev | git apply --index; git commit
This is sample output - yours may be different.
Use this to make a new commit that "softly" reverts a branch to some commit (i.e. squashes the history into an inverse patch). You can review the changes first by doing the diff alone.
convert -resize 50%x50% image{,_resize}.jpg
This is sample output - yours may be different.
git daemon --reuseaddr --verbose --export-all --base-path=/parent/of/bare/git/repos
This is sample output - yours may be different.
(git daemon has no startup output)
Use this to start git daemon serving all git repos under a path.
tail -f <filename> | grep -C <# of lines to show above and below> <text>
This is sample output - yours may be different.
alias scd='dirs -v; echo -n "select number: "; read newdir; cd -"$newdir"'
This is sample output - yours may be different.
$ cd programs/
$ cd
$ scd
0 ~
1 ~/programs
select number:
cflow file.c | grep ':$' | sed 's/ <.*//'
This is sample output - yours may be different.
tar -cvzf - /source/path | ssh <targethostname> -l <username> dd of=/destination/path/backupfile.tgz
This is sample output - yours may be different.
Creates a quick backup with tar to a remote host over ssh.
mysqlcheck -a --auto-repair -c -o -uroot -p [DB]
This is sample output - yours may be different.
A useful way to do a full check and auto repair damaged databases
pg_dump -U postgres [nomeDB] > db.dump
This is sample output - yours may be different.
This is sample output - yours may be different.
$ ls /etc/apache2/httpd.conf-example
/etc/apache2/httpd.conf-example
$ file !$
file /etc/apache2/httpd.conf-example
/etc/apache2/httpd.conf-example: ascii text
Bash shortcut to work with the last argument of your last command
pidof () { ps acx | egrep -i $@ | awk '{print $1}'; }
This is sample output - yours may be different.
This is sample output - yours may be different.
$ perl -e "use SOAP::Lite"
$
$ perl -e "use SOAP::Lit"
Can't locate SOAP/Lit.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.8/i86pc-solaris /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/i86pc-solaris /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Quick command to check if Perl library is installed on your server.
perl -pe 's/.+;//' ~/.zsh_history | sort | uniq -c | sort -r|head -10
This is sample output - yours may be different.
3940 ls
1427 sudo emerge -vpuDN world
1084 top
684 tail /var/log/samba/log.smbd -n 50
601 sudo emerge --sync
573 sudo emerge --depclean
566 ls -alh
561 df -ah
523 cd
430 sudo revdep-rebuild
alias rot13='perl -pe "y/A-Za-z/N-ZA-Mn-za-m/;"'
This is sample output - yours may be different.
~% echo Command-line-fu | rot13
Pbzznaq-yvar-sh
~% echo Pbzznaq-yvar-sh | rot13
Command-line-fu
E.g. Useful for hiding spoilers in reviews, etc.
guid(){ lynx -nonumbers -dump http://www.famkruithof.net/uuid/uuidgen | grep "\w\{8\}-" | tr -d ' '; }
This is sample output - yours may be different.
perl -le 'print join ", ", map { chomp; $_ } <>'
This is sample output - yours may be different.
email@number.one, email@number.one, email@number.one, ...
joins multiple lines to create single line with comma separated values. for example if we have an email addresses one per line (copy&paste from spreadsheet) it will oputput one line with comman separated addresses to put it to email client.
gsed -e :a -e 's/\(<\/[^>]*>\)/\1\n/g;s/\(<br>\)/\1\n/g' page2.txt | sed -n '/<cite>/p;s/<cite>\(.*\)<\/cite>/\1/g' >> output
This is sample output - yours may be different.
From a saved page of google search results, split out all of the links for the results. Useful for creating apache rewrite rules from.
perl -MHTML::Entities -ne 'print encode_entities($_)' /tmp/subor.txt
This is sample output - yours may be different.
Encodes HTML entities from input (file or stdin) so it's possible to directly past the result to a blog or HTML source file.
find ~ -name '*.mp4' | xargs mplayer
This is sample output - yours may be different.
rsync -av --progress ./file.txt user@host:/path/to/dir
This is sample output - yours may be different.
transfer files from localhost to a remotehost.
sed "s/^ABC/+ABC/" <file | sed "s/DEF$/DEF+/" | tr "\n" "~" | tr "+" "\n" | grep "^ABC" | tr "~" "\n"
This is sample output - yours may be different.
If the file content is :
-
Blah blah blah
ABC
hello blah blah blah
bloh bloh bloh
DEF
Bah bah bah
-
You'll get:
-
ABC
hello blah blah blah
bloh bloh bloh
DEF
find . -exec grep "test" '{}' /dev/null \; -print
This is sample output - yours may be different.
fuman(){ lynx -width=$COLUMNS -nonumbers -dump "http://www.commandlinefu.com/commands/using/$1" |sed '/Add to favourites/,/This is sample output/!d' |sed 's/ *Add to favourites/----/' |less -r; }
This is sample output - yours may be different.
----
Check out hijacked files in clearcase
xxd < orig | sed 's/A/B/' | sed 's/HEXA/HEXB/' | xxd -r > new
This is sample output - yours may be different.
----
Binary search/replace
Replaces A with B in binary file "orig" and saves the result to "new". You must have the hex representations of A & B. Try od: echo -e "A\c" | od -An -x
sed -i.`date +%Y%m%d` -e 's/pattern/replace' [filename]
This is sample output - yours may be different.