Linux Basic and Advanced Commands for Beginners

Ubuntu is an open source operating system for all users. Here Ubuntu/Linux basic and advanced commands for beginners and admins.

Ubuntu/Linux commands for Ubuntu users:


Below commands related to the system by using the terminal

uname -a — Display LINUX system information

uname -r — Display kernel release information

uptime — Show how long the system has been running + load

hostname — Show system hostname

hostname -i — Display the IP address of the host

last reboot — Show system reboot history

date — Show the current date and time

cal — Show this month calendar

whoami — Who you are logged in as        


Is -al –Display all information about files/ directories

pwd –Show the path of the current directory

mkdir directory-name –Create a directory

cp  file l   file 2 –Copy file l to file 2

cp -r dir 1 dir 2 –Copy dir 1 to dir 2, create dir 2 if it doesn’t exist

mv file l file 2 –Rename source to dest / move source to directory

touch file –Create or update file

cat > file –Place standard input into file

more file –Output contents of the file

head file –Output first 10 lines of file

tail file –Output last 10 lines of file

wc –print the number of bytes, words, and lines in files

xargs –Execute command lines from standard input.

rm file-name –Delete file

rm -r directory-name –Delete directory recursively

rm -f file-name –Forcefully remove file

rm -rf directory-name –Forcefully remove directory recursively


ps –Display your currently active processes

pmap –Memory map of the process

top –Display all running processes

bg –Resumes suspended jobs without bringing them to the foreground

fg –Brings the most recent job to foreground
fg n –Brings job n to the foreground

kill pid –Kill process with     mentioned pid id
kill all proc –Kill all processes named proc
pkill process-name –Send signal to a process with its name

ps aux | grep ‘telnet’ –Find all process id related to telnet process



ifconfig — Display ip address in ubuntu

ip addr show –Display all network interfaces and ip address 

ip address add dev eth0 –Set IP address

mii-tool eth0 –Linux tool to show ethernet status
ping host –Send echo request to test

dig domain –Get DNS information for the domain

dig -x host –Reverse lookup host

host –Lookup DNS ip address for the name

hostname -i –Lookup local ip address

wget file –Download file

netstat -tupl –Listing all active listening     ports.



rpm -i pkg name.rpm –Install rpm based package
rpm -e pkg name –Remove package


dmesg –Detected hardware and boot messages

cat /proc/cpuinfo –CPU model

cat /proc/meminfo –Hardware memory

cat /proc/interrupts –List the number of inturrepts per CPU per I/O device

lshw –Display information on hardware configuration of the system

lsblk –Displays block device-related information in LINUX

free -m –Used and free memory(-m for MB)

lspci -tv –Show PCI devices

lsusb -tv –Show USB divices

dmidecode –Show hardware info from the BIOS



id –Show the active user id with login and group

last –Show last logins on the system

who –Show who is logged on the system

usermod –Modify user information.

groupadd admin –Add group “admin”
useradd -c “Sam Tomshi” –g admin -m sam #Create user “sam”
userdel sam –Delete user sam
adduser sam –Add user “sam”



chmod octal file-name –Change the permissions of file to octal
chmod 777 /data/test.c –Set rwx permission for owner,group,world
chmod 755 /data/test.c –Set rwx permission for owner,rx for group and world
chown owner-user file –Change owner of the file
chown owner-user:owner-group file-name –Change owner and group owner of the file
chown owner-user:owner-group directory –Change owner and group owner of the directory.



tar cf home.tar home –Create tar named home.tar containg home
tar xf file.tar –Extract the files from file.tar
tar czf file.tar.gz files –Create a tar with gzip compression
gzip file –Compress file and renames it to file.gz



df -h –Show free space on mounted filesystems
df -i –Show free inodes on mounted filesystems
fdisc -l –Show discs partitions sizes and types
du -ah –Display disc usage in human readable form
du -sh –Display total dosc usage on the current directory
findmnt –Displays target mount point for all filesystem
mount device-path mount-point –Mount a device


cd .. –To go up one level of the directory tree
cd –goto $HOME directory
cd/test –Change to/Test directory