Linux Commands - Part 2

Linux command line reference for common operations (part 2).
Examples marked with are valid/safe to paste without modification into a terminal, so
you may want to keep a terminal window open while reading this so you can cut & paste.
All these commands have been tested both on Fedora and Ubuntu.

Linux Commands - part 2   Command Description   archives and compression     gpg -c file Encrypt file   gpg file.gpg Decrypt file   tar -c dir/ | bzip2 > dir.tar.bz2 Make compressed archive of dir/   bzip2 -dc dir.tar.bz2 | tar -x Extract archive (use gzip instead of bzip2 for tar.gz files)   tar -c dir/ | gzip | gpg -c | ssh user@remote 'dd of=dir.tar.gz.gpg' Make encrypted archive of dir/ on remote machine   find dir/ -name '*.txt' | tar -c --files-from=- | bzip2 > dir_txt.tar.bz2 Make archive of subset of dir/ and below   find dir/ -name '*.txt' | xargs cp -a --target-directory=dir_txt/ --parents Make copy of subset of dir/ and below   ( tar -c /dir/to/copy ) | ( cd /where/to/ && tar -x -p ) Copy (with permissions) copy/ dir to /where/to/ dir   ( cd /dir/to/copy && tar -c . ) | ( cd /where/to/ && tar -x -p ) Copy (with permissions) contents of copy/ dir to /where/to/   ( tar -c /dir/to/copy ) | ssh -C user@remote 'cd /where/to/ && tar -x -p' Copy (with permissions) copy/ dir to remote:/where/to/ dir   dd bs=1M if=/dev/sda | gzip | ssh user@remote 'dd of=sda.gz' Backup harddisk to remote machine   rsync (Network efficient file copier: Use the --dry-run option for testing)     rsync -P rsync://rsync.server.com/path/to/file file Only get diffs. Do multiple times for troublesome downloads   rsync --bwlimit=1000 fromfile tofile Locally copy with rate limit. It's like nice for I/O   rsync -az -e ssh --delete ~/public_html/ remote.com:'~/public_html' Mirror web site (using compression and encryption)   rsync -auz -e ssh remote:/dir/ . && rsync -auz -e ssh . remote:/dir/ Synchronize current directory with remote one   ssh (Secure SHell)     ssh $USER@$HOST command Run command on $HOST as $USER (default command=shell) • ssh -f -Y $USER@$HOSTNAME xeyes Run GUI command on $HOSTNAME as $USER   scp -p -r $USER@$HOST: file dir/ Copy with permissions to $USER's home directory on $HOST   ssh -g -L 8080:localhost:80 root@$HOST Forward connections to $HOSTNAME:8080 out to $HOST:80   ssh -R 1434:imap:143 root@$HOST Forward connections from $HOST:1434 in to imap:143   wget (multi purpose download tool)   • (cd cli && wget -nd -pHEKk http://www.it.toata.info) Store local browsable version of a page to the current dir   wget -c http://www.example.com/large.file Continue downloading a partially downloaded file   wget -r -nd -np -l1 -A '*.jpg' http://www.example.com/dir/ Download a set of files to the current directory   wget ftp://remote/file[1-9].iso/ FTP supports globbing directly • wget -q -O- http://www.example.com/timeline.html | grep 'a href' | head Process output directly   echo 'wget url' | at 01:00 Download url at 1AM to current dir   wget --limit-rate=20k url Do a low priority download (limit to 20KB/s in this case)   wget -nv --spider --force-html -i bookmarks.html Check links in a file   wget --mirror http://www.example.com/ Efficiently update a local copy of a site (handy from cron)

Part 1 of Linux Commands


Sursa
2009-02-21 19:07:41



Comenteaza





Ultimele 25 posturi adăugate

18:12:00din cosmograme —» Leo Butnaru
05:56:00DIN POEZIA LUMII —» Leo Butnaru
11:11:00DE BLAJINI —» Leo Butnaru
18:56:00DECENȚĂ ȘI TICĂLOȘIE —» Leo Butnaru
16:43:00GOGOMĂNIA —» Leo Butnaru
17:01:00Teslev, moldoveanul campion european la fotbal. Istorii cu dinozauri. Povești din Imperiu 💥😲🔝 —» Sandu GRECU
09:27:29O dublă lansare de carte la BM „B.P. Hasdeu” —» Biblioteca de Arte 'Tudor Arghezi'
05:16:00DIN POEZIA LUMII —» Leo Butnaru
09:58:00MS Projects se extinde în Republica Moldova: expertiză regională pentru proiecte logistice complexe 🌠 —» Sandu GRECU
14:50:00Din antologia transfrontalieră, în limba spaniolă ȘI SĂ FIU PRECUM STEAUA INACCESIBILĂ, ÎNALTĂ, STRĂLUCIND ÎN TĂCERE —» Leo Butnaru
05:52:00LACONIC —» Leo Butnaru
10:34:01Iar a doua zi s-o iau de la început… —» Biblioteca de Arte 'Tudor Arghezi'
10:29:00Campanie de responsabilitate socială desfășurată de Loteria Națională a Moldovei în preajma sărbătorilor pascale 🌟 —» Sandu GRECU
06:33:00NUMELE CA DESTIN ȘI DEMNITATE —» Leo Butnaru
12:38:00Cristian Obadă, călare pe măgar. Iaralov și punga cu bani pentru Argentina. Legenda Vus 🔥🔥🔥 —» Sandu GRECU
09:07:00Jumătate de secol de istorie a sportului. Ion Gheorghiu, la 50 de ani —» Sandu GRECU
12:58:46Chișinăul cultural la o margine de secol —» Biblioteca de Arte 'Tudor Arghezi'
07:36:58Recomandarea săptămânii: Radacini Fiori Rara Neagră —» Fine Wine
06:27:06Evanghelia la Bunavestire – Comentarii Patristice —» Portalul Tineretului Ortodox din Moldova
06:03:00DIN POEZIA LUMII —» Leo Butnaru
19:51:08Verdict: despre abuzurile unui primar —» Curaj.TV | Media alternativă
19:40:22Anatol Matasaru a fost reținut în timp ce investiga averea unei judecătoare —» Curaj.TV | Media alternativă
19:38:30Pogromul de la Chișinău în timpul țarismului —» Curaj.TV | Media alternativă
08:40:00Ziua Internațională a Poeziei ,,Poezia – punte pentru pace și solidaritate” —» Biblioteca Publică or.Rîşcani
04:02:39Semnificatia fiecarei zile din Saptamana Patimilor —» Portalul Tineretului Ortodox din Moldova