Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

      echo "message" : displays/prints 'message'.

Examples:
     echo Hello
        Hello
     echo "Hello there"
        Hello there

...

printf

      printf : produces  produces output  according to a format.

...

Most useful search options:

-name ...search for files/directories with a certain name or part of name. Wildcards can be used.
-type ...search for certain files types only. 'd' → directories; 'f' → files; 'l' → symbolic links
-exec ...execute the following command on each found file/directory. '{}' serves as placeholder for found files/directories
needs to get terminated with '\;'

For example, it can be used in combination with 'grep':

     find . -name '*.sh' -exec grep case {} \;

The above command will print all lines containing the word 'case' of files with end on '.sh'.

...

While 'cp' can only be used to copy files and directories on the same machine, there are tools that can copy files and directories from one machine to another.

rsync

      'rsync :  which ' stands for remote sync, . It is a remote and local file and directory synchronization tool. a fast, versatile, remote (and local) file/directory-copying tool
Usage

Examples:
      rsync  origin  destination
      rsync  user@origin username@remote_origin_machine:origin  destination
      rsync  origin  user@destination origin  username@remote_destination_machine:destination
'origin' and 'destination' can be file(s) files and/or directories.

Only either the origin or the destination machine can be a nother another machine, not both.
Options:The 'username@' only needs to be given for the remote machine and only if the username is different from the one on the local machine.
The default directory on the remote machine is the home directory. If the remote file/directory is not in the home directory a path need to be specified, either from the home directory or a full path.


Most useful options:

-v    -vverbose
-rRecursively recursively copy entire directories
-uupdate, forces rsync to skip any files which exist on the destination and have a modified time that is newer than the source file.
-llinks, when symlinks are encountered, recreate the symlink on the destination
-Lcopy-links, When symlinks are encountered, the item that they point to (the referent) is copied, rather than the symlink.
-tpreserves preserve time
-ppreserves permissionspreserve permissions - do not use when copying to clusters of the Alliance!!!


scp

scp : secure copy (remote file copy program)

Usage: similar to rsync aboveOptions

Most useful options:

...



-rRecursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal.

ftp / sftp

Also see:
sftp
: secure file transfer program
ftp : Internet file transfer program

wget

wget : web downloader
GNU Wget is a free utility for non-interactive download of files from the Web.

Example:
    $        wget www.tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.pdf

File archiving and compressions

...