SSH, or Secure Shell, performs like a remote administration protocol helping users control and modify their remote servers over the Internet.
For MAC and Linux users, SSH quite easy to attain and use In windows, you will need SSH clients to open SSH connections.
The most popular SSH client is none other than PUTTY.
For Linux and MAC, head over to the terminal and execute the following code
Here, the user is the account you want to access and the host is the computer you want to access. It can be either a domain name or an IP address.
Tap enter to proceed. Via entering, as the next step, you are asked for the password of the requested account. Enter the password and hit enter. You will be connected to the remote terminal window.
BASIC SSH COMMANDS:
Here we will go through popular ssh commands with syntaxes and useful options.
| SSH Command||Explanation|
|ls||Show directory contents (list the names of files)|
|cd ||Change directory|
|mkdir||Create a new folder (directory)|
|rm||Remove a file|
|pwd||Show current directory (full path to where you are right now)|
|grep ||Search for a specific phrase in file/lines|
|find||Search files and directories|
|history||Show last 50 used commands|
|clear||Clear the terminal screen|
|tar ||Create & Unpack compressed archives|
|wget ||File downloading from the internet|
|du ||Get file size|
ls command is used to list all files and directories.
Where cybrosys is the directory in the home directory.
cd is the short form of change directory, it is used to jump into the directory.
cybrosys@cybrosys:/$ cd /home
You can also write the full path of the directory.
cybrosys@cybrosys:~$ cd /home/cybrosys/odoo
cd / takes you to the root directory.
cybrosys@cybrosys:/home$ cd /
mkdir command is used to make directory.
Example: mkdir yourFolder
It is used to create a file.
One can create a file with or without extension. The extension can be anything.
It is used to remove a file or directory.
rm [file name]
Example: rm main.py
To delete a folder, use -r to remove all files and subfolders in it.
rm -r home/cybrosys/folder
It is used to display the content of a file.
cat [file name]
It is used to copy files and folders
cp [options] [source] [destination]
It is used to move files or folders.
mv [source] [destination]
It will search for the given string in the file.
grep 'line_ids' main.py
vi and nano are two text editors that can be used in the command line. If the file does not exist both text editors will create it.
vi [file name]
nano [file name]
history command: This command is used to display last used commands.
1. sudo apt-get update
2. sudo apt-get upgrade
To copy a file from the local system to server system :
sudo scp -r [source location ] root@[server ip]: [destination location]
sudo scp -r /home/cybrosys/odoo/custom_addons root@[server ip]:/opt/odoo/
When you hit enter, it will ask the password of the local system as well as the server system. After entering both, it will start copying.
To edit file from terminal:
sudo nano [file name]
It will open the file in the nano text editor.
sudo nano /etc/odoo.conf
Save the file and restart the service.
To save the file: Ctrl+x then Y and Enter.
To start the service:
sudo systemctl start [service file]
sudo systemctl start odoo.service
To stop the service:
sudo systemctl stop [service file]
sudo systemctl stop odoo.service
To check status of the service:
sudo systemctl status [service file]
sudo systemctl status odoo.service