Linux Terminal Commands
In this article we will learn commonly used terminal commands for linux.
Having some familiarity with these commands will help you in manage a linux based server. Which will help you understand how to host your services on cloud.
Prerequisite Knowledge
To understand this guide you dont need to be an expert but having some basic familiarity with linux will help you.
Let us begin the step by step guide to learn systemctl commands
Access a remote computer
Code
ssh root@0.0.0.0
If you want to access and login to a remote system you need to use SSH command. You have to provide a username and Ip address of the service. After you hit enter it will ask your user password. When you enter correct password. You can access a remote system.
Unzip a zip file
If the unzip command isn’t already installed on your system, then run:
Code
sudo apt-get install unzip
After installing the unzip utility, if you want to extract to a particular destination folder, you can use:
Code
unzip file.zip -d destination_folder
Download a File from internet
Code
wget [File-URL]
This command downloads the file with the given link
Print working directory
Code
pwd
see the full path of current directory
Show hidden files
Code
ls -a
Normal ls command will not show you hidden files. Use this command to see hidden files.
Show Files with their file Size
Code
ls -lh
Move files from one folder to another and Rename files
Code
mv /path_to_source_folder/filename /path_to_destination_folder/
This commands moves file from one folder to another folder. It is also used for renaming files. When you want to rename a file make sure the source path and destination path is same.
See disk folder data usage
Code
du -hs /path/to/directory
Copy files and directory
scp command is used to copy files from one system to another system.
Code
scp -r root@139.59.79.32:/local/storage/directory /home/user/localfolder
Copy directory from local storage to Server
Code
scp -r /path/to/jar/filename.jar root@0.0.0.0:/nearbyshops
Copies files in directory of local server to remote server with ip and path on remote server
Code
scp -r /path/to/my/files root@0.0.0.0:/path/on/remote/system
See a log
Just use the journalctl command, as in:
Code
journalctl -u service-name.service
See the most recent logs ... logs sorted in reverse with recent logs appearing first:
Code
journalctl -u service-name.service -r
Or, to see only log messages for the current boot:
Code
journalctl -u service-name.service -b
You can omit the .service prefix and it will just be fine
Code
journalctl -u service-name
SystemD
See full log using systemD
https://unix.stackexchange.com/questions/225401/how-to-see-full-log-from-systemctl-status-service