Basics of using the Linux Command Line / SSH
Overview
This is a short sequence of videos discussing some basics of using the Linux command line (the Terminal.) Aimed at users new to the Linux command line this sequence of tutorials gives advice and information for using the Linux command line after connecting to the terminal or via SSH.
Pre-requisites
- You'll need to be connected via SSH or on the terminal of Linux server / machine.
Episodes
Part 1:
Video:
Useful links / code from the video:
Prints the current working directory (will show you what directory you are in.):
pwd
List the files in the directory you are in:
ls
Change the directory you are in:
cd
Change to the directory above the one you are in (the parent directory):
cd ..
Read the contents of a file:
cat
Text editor to edit the contents of a file:
vi
Move (cut) a file to another location:
mv
Part 2:
Video:
Useful links / code from the video:
Installs nano on a Redhat / Centos system:
yum install nano
Install nano text editor on Ubuntu / Debian:
apt-get install nano
Download a file from the World Wide Web:
wget
Read the contents of a file and search it for something in this case the word searchterm:
cat filename.txt | grep searchterm
Create a file:
touch
Create a directory:
mkdir
List files in the directory showing permissions, sizes (human readable) last modified times an :
ls -laSh
Part 3:
Video:
Useful links / code from the video:
Updates software repository and if successful upgrades installed software on the system (For CentOS and Red-Hat based distributions):
yum update && yum upgrade
Updates software repository and if successful upgrades installed software on the system (For Ubuntu / Debian based distributions):
apt-get update && apt-get upgrade
View space available on the server in a human readable format:
df -h
list disks, partitions and volumes for the server:
lsblk
Details of server CPUs:
lscpu
View live system usage information:
top
View available and used memory:
free
Connect via SSH from one Linux machine to another (in this case connect to the root user account for myserver.serverdown.co.uk):
ssh [email protected]
List processes listening on TCP along with their port numbers:
ss -plnt
Set the hostname on a CentOS system:
hostnamectl set-hostname chosenhostname.serverdown.co.uk
Check the hostname of the system:
hostnamectl status
Spotted a mistake? Have a comment or suggestion? We'd love to hear from you. Please feel free to get in contact.
All information provided by Rootchronicles.com is without warranty. We take no responsibility for any loss, damage or any other misfortune resulting from following or attempting to follow guidance found on this site. If in doubt always seek professional consultation.