Useful commands for linux servers…
Useful commands for linux servers…

Useful commands for linux servers…

Useful commands for linux servers…

 

##################### USEFUL COMMANDS FOR LINUX SERVERS ########################

# ssh
ssh [user@]hostname
## Is a program for logging/execute into a remote machine. It provides secure encrypted communications.
## It always requires a hostname, and it usually requires a username and a password.

# htop
htop
## Provides a dynamic real-time summary information of processes or threads currently being managed by the server. It is useful to know the available resources like CPUs and RAM.

# free
free
## Display amount of free and used memory in the system

# screen
screen
programX
Ctrl+a+d
programY
screen -r
## It allows you to execute the program X and let it run while you execute the Y program or do something else in the terminal.
screen -r
## The -r option allows you to return to the last screen.
Ctrl+a+d
## It detaches you from the current screen

# exit
exit
## It allows you to close the screen windows or to log out of the server.

# Ctrl + z
python
Ctrl + z
cp ../aguacate.txt .
fg
## It allows you to save the session of a program while you return to the terminal. If you are in python and you need to copy a file to the current directory, you can use Ctrl + z to go to the terminal without loosing the python terminal
## You can use it as many times as you wish, in other words, have multiple programs in execution
fg
## fg will return you to the python session. It allows you to return to the programs in execution

# scp
scp FilePathOrigin FilePathDestiny
scp File user@host/:Path
scp user@host/:Path .
## It allows you to copy files from an origin directory to destiny directory. Both directories can be hosted in the same server/computer. However, the second command copies a file in the working directory to a server; the second one is the opposite.

# ps
ps
## list your current processes

# pkill
## pkill 666
## Kills the process with the ID 666. You can check the IDs of your processes with ps.


date   # Prints the date
whoami   # Prints your username
hostname   # Prints the server/host name