Both sides previous revision Previous revision Next revision | Previous revision |
user:madjid [2023/01/05 15:00] – created madjid | user:madjid [2023/01/11 13:04] (current) – madjid |
---|
====== SSH commands ====== | ====== Commandes SSH ====== |
| ==== Copier un seul fichier d'un ordinateur local vers un ordinateur distant en utilisant scp. ==== |
==== Copy single file from local to remote using scp. ==== | |
| |
<code code> | <code code> |
$ scp myfile.txt remoteuser@remoteserver:/remote/folder/ | $ scp myfile.txt remoteuser@remoteserver:/remote/folder/ |
</code> | </code> |
| Si le dossier cible (///remote/folder///) n'est pas spécifié, il copiera le fichier dans le répertoire personnel de l'utilisateur distant. |
| |
If the target folder (///remote/folder///) is not specified, it will copy the file to the remote user's home directory. | ==== scp d'un ordinateur distant vers un ordinateur local en utilisant un seul fichier. ==== |
| |
==== scp from remote to local using a single file . ==== | |
| |
<code code> | <code code> |
$ scp remoteuser@remoteserver:/remote/folder/remotefile.txt localfile.txt | $ scp remoteuser@remoteserver:/remote/folder/remotefile.txt localfile.txt |
</code> | </code> |
| En utilisant //.// comme cible de copie (en remplaçant //localfile.txt//), le fichier distant sera copié dans le répertoire de travail courant en utilisant le même nom de fichier (//remotefile.txt//). |
| |
Using //.// as the copy target (replacing //localfile.txt// will copy the remote file to the current working directory using the same filename (//remotefile.txt//) | ==== Concaténer le contenu d'un fichier sur un ordinateur local à un autre fichier sur un serveur distant. ==== |
| |
====== concatenate the contents of a file on local machine to another file on a remote server . ====== | Pour concaténer le contenu d'un fichier sur votre ordinateur local à un autre fichier sur un serveur distant, vous pouvez utiliser la commande ''%%scp%%'' avec les commandes ''%%cat%%'' et ''%%tee%%'', ainsi que l'option ''%%-a%%'' pour ''%%tee%%''. |
| |
To concatenate the contents of a file on your local machine to another file on a remote server, you can use the **''%%scp%%''** command with the **''%%cat%%''** and **''%%tee%%''** commands, along with the **''%%-a%%''** option for **''%%tee%%''**. | Voici un exemple de comment utiliser ''%%scp%%'', ''%%cat%%'' et ''%%tee%%'' pour concaténer le contenu d'un fichier sur votre ordinateur local à un autre fichier sur un serveur distant : |
| |
Here's an example of how you can use **''%%scp%%''**, **''%%cat%%''**, and **''%%tee%%''** to concatenate the contents of a file on your local machine to another file on a remote server: | |
| |
<code code> | <code code> |
cat /path/to/local/file | ssh username@remote "tee -a /path/to/remote/destination"d | cat /path/to/local/file | ssh username@remote "tee -a /path/to/remote/destination"d |
</code> | </code> |
| Ceci ajoutera le contenu de ''%%/path/to/local/file%%'' sur votre ordinateur local à la fin du fichier situé à ''%%/path/to/remote/destination%%'' sur le serveur distant. |
| |
This will append the contents of **''%%/path/to/local/file%%''** on your local machine to the end of the file at **''%%/path/to/remote/destination%%''** on the remote server. | Alternativement, vous pouvez utiliser la commande ''%%cat%%'' avec l'opérateur ''%%>>%%'' pour ajouter le contenu d'un fichier sur votre ordinateur local à un autre fichier sur un serveur distant. Voici un exemple de comment utiliser cette méthode : |
| |
Alternatively, you can use the **''%%cat%%''** command with the **''%%>>%%''** operator to append the contents of a file on your local machine to another file on a remote server. Here's an example of how you can use this method: | |
| |
<code code> | <code code> |
</code> | </code> |
| |
This will also append the contents of **''%%/path/to/local/file%%''** on your local machine to the end of the file at **''%%/path/to/remote/destination%%''** on the remote server. | Cela ajoutera également le contenu de ''%%/path/to/local/file%%'' sur votre ordinateur local à la fin du fichier situé à ''%%/path/to/remote/destination%%'' sur le serveur distant. |
| |
| ====== Commandes SQL ====== |
| ==== supprimer une base de données spécifique dans Postgres s'exécutant dans un conteneur Docker : ==== |
| |
| <code code> |
| docker exec -it container_db_name psql -U odoo -d template1 -c 'drop database "db_name " ' |
| </code> |