Basic Linux Commands:
Viewing, copying, moving and deleting files
Display the contents of the current
ls
directory
Display also hidden files and hidden
ls -a
directories
cp filename Copy filename into directory
/path/dir_name /path/dir_name
cp -r dir_name Copy the entire dir_name into
/path/dir_name2 /path/dir_name2
cp filename1 filename2 Copy filename1 and filename2 into
/path/dir_name /path/dir_name
rm name Remove a file or directory called name
Remove an entire directory as well as its
rm -r name
included files and subdirectories
mv filename
Move filename into /path/dir_name
/path/dir_name
mv filename1 filename2 Rename filename1 to filename2
cat filename Display filenames contents
Display filename in pages. Use spacebar to
more filename
view next page
head filename Display filenames first 10 lines
head -15 filename Display filenames first 15 lines
tail filename Display filenames last 10 lines
tail -15 filename Display filenames last 15 lines
pwd Display current directory
cd /path/dir_name Change to directory /path/dir_name
cd .. Go 1 directory up
mkdir dir_name Create directory dir_name
rmdir dir_name Delete directory dir_name
User administration
users Display users currently logged in
who List logged-in users
whoami Display current user
su Log in as root from current login
su - Log in as root from current login and take root's path
exit Exit from console login (ie, logout).
Processes
ctrl+z Suspend a program
ctrl+c Interrupt a program
ps List all processes
kill -9 pid Kill process with id pid
top Monitor processes in real time
Networking
hostname List the system's hostname
ifconfig Set/Display network information
host ip Resolves ip's hostname
ping ip/hostname Check if ip/hostname is reachable
traceroute ip/hostname Find network path to ip/hostname
System Information
uname -a General system information
fdisk -l List partition tables
cp filename Copy filename into directory
/path/dir_name /path/dir_name
df -T –h List filesystem disk space usage