Frequent commandos SSH Shell

Listing of the SSH commandos who are used with more frequency. The commandos are organized by subject and include a brief description to understand as using them.

Source: Carat-Hosting
Published the (updated )


Commandos of navigation

He shows path complete of the directory in whom you are

pwd

To accede to a directory without mattering where you are indicating path complete

CD /home/usuario/public_html/

To accede to a directory of your present location, for example subdirectory

CD subdirectory

To return to the home directory

CD ~

To go to the last directory in whom you were

CD -

Superior raises a directory

CD.

Listing of archives

List archives and directories of a directory

ls

List archives and directories and information on the same

ls - al

List archives and information including all the subdirectories

ls - aR

List archives and information including all the subdirectories by screens

ls - aR | it dwells

List archives and information of subdirectories and keeps it in a file

ls - alR > resultado.txt

It shows to the content of the file resultado.txt

cat resultado.txt

List all the archives finished in .html

ls *.html

List archives and information of a subdirectory

ls - al subdirectory

To create, to publish or to eliminate archives and directories

Nano publishes the index.html file with the publisher

nano /home/usuario/public_html/index.html

It creates the empty file 404.html in a directory

touch /home/usuario/public_html/404.html

It eliminates a file, for example archivo.txt. By security it executes the commando from the directory where is the file that you want to eliminate.

CD /home/usuario/public_html/directorio rm archivo.txt

To eliminate a directory and all their content.

Taken care of! it eliminates the indicated directory and all their content. By security it executes the commando from the directory where is the subdirectory that you want to eliminate.

CD /home/usuario/public_html/directorio rm - RF subdirectory

A called directory creates unloadings

to mkdir unloadings

He eliminates the called directory unloadings

to rmdir unloadings

Compression and decompression of archives

To compress directory

zip archivo.zip /home/usuario/public_html/directorio

To decompress archivo.zip

unzip archivo.zip

To see content of archivo.zip

unzip - v archivo.zip

To copy archives or directories

To copy a file

cp - to archivo.zip archivocopia.zip

To clone a directory.

We suppose that we want to duplicate to the /home/usuario/public_html/img directory and all their content. We accede to the directory public_html and we duplicated to the directory img and all their content maintaining its respective permissions in a new called directory imgcopia. He is importande to emphasize that the duplication will work as we waited for if the directory imgcopia does not exist. If he were created previously, a called directory would be created img within the directory imgcopia.

CD /home/usuario/public_html cp - to img imgcopia

To copy all the content of a directory in another directory who already exists

cp - to img/* imgcopia

Dividing of the previous example the commando img in the directory will copy all the content of the directory imgcopia. If in the copy process the origin directory contains archives that already exist in the destiny directory, confirmation for sobreescribirlo will be asked for. So that the system does not ask before sobrewriting an existing file adds option - f.

cp - high frequency img/* imgcopia

The possibility that fits cp exists an alias for the commando so that by defect is executed with the option - i (to ask before sobrewriting, alias cp='cp - i') and the commando - f does not provide effect. In that case you can omit temporarily alias adding one contrabarra or backslash \ before the commando.

\ cp - high frequency img/* imgcopia

Other SSH commandos

he shows is total space occupied by the directory in whom one is

du - sh

he shows to the occupied space of each file and directory ordered by size

du - hs * | sort - h

to use Lynx navigator to accede to www.carat-hosting.com

lynx carat-hosting.com

he shows his name of user

whoami

Updates

26-10-2012 Added to new options and examples for the commando it copies cp in section €œTo copy archives or directories€.