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

21:10:16The 10 Health Benefits of Wine Will Inspire You to Pour a Hearty Glass Tonight —» ajna-blogging-press
20:15:05Горит ЧЕК, аварийный режим. Удаление сажевых фильтров DPF —» Сажевые фильтры (DPF/ FAP). Чип тюнинг. Теория, практика.
20:05:51Турбо-утюг BMW F30 335 ActiveHybrid3. Stage1- 418 HP. Project 500 HP —» Сажевые фильтры (DPF/ FAP). Чип тюнинг. Теория, практика.
19:11:28Правительство элитарного меньшинства не будет решать проблемы большинства —» Блог Михаила Полянского
17:59:00©️ Îmbrățișează mai des, mai strâns, cu iubire… —» Licurici de suflet
14:17:23Adevărul. Puncte de sprijin și influența Internetului. —» … mai mult emoţii, decît cuvinte.
12:46:23Gheorghe Balan și-a dat demisia de la șefia Inspectoratului General de Poliție —» Elena Robu
12:19:17Cum vor fi judecați soțul cu soția? [Pastor Vasile Filat, 2019] —» Moldova Creștină
12:10:14Poliţia filmează şi ofensează la poarta pieţei —» Curaj.TV | Media alternativă
11:59:12Visătoarea cu ochii de culoarea cerului... —» BiblioCity
11:57:30Dialog în miez de toamnă cu Doina Postolachi —» BiblioCity
11:41:42Large Bedroom Mirror —» Andrei Fornea
11:28:18Exportul Vinului Moldovei înregistrează cel mai înalt nivel nivel din ultimii 5 ani —» Elena Robu
11:05:14Stema și Drapelul municipiului Ungheni —» Blogul lui Marin Bodrug
10:52:58Average Cost Of A Couch —» Andrei Fornea
10:31:57Garden Box Designs —» Andrei Fornea
10:31:31Au blocat mașina unui funcționar și au chemat poliția —» Curaj.TV | Media alternativă
09:58:58Discriminată la gara auto din Comrat —» Curaj.TV | Media alternativă
07:52:58Toamnă târzie* —» Andrei LANGA. Blogul personal
07:48:57Молодежь шагает по планете. —» Biblioteca Publică or.Rîşcani
07:31:33Oportunităţile UE pentru tineri din Moldova —» Biblioteca Publică or.Rîşcani
02:09:57Why Canadians send me to the Russians?! —» plop andrei
22:30:08Иван Фёдорович Александровский - русский художник, фотограф, инженер и изобретатель. —» Удивительные истории из жизни великих людей
20:42:54“Crime Against Democracy”: U.S. Backed Fascist Coup in Bolivia —» ajna-blogging-press
20:35:46Poliţia sperie taximetriştii din staţie şi intersecţie —» Curaj.TV | Media alternativă