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:

SYSTEM COMMANDS:

Below commands related to the system by using 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        

FILE COMMANDS:

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

PROCESS RELATED COMMANDS:

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

 

NETWORK COMMANDS:

ifconfig — Display ip address in ubuntu

ip addr show –Display all network interfaces and ip address 





ip address add 192.168.0.1 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 commandstech.com –Lookup DNS ip address for the name


hostname -i –Lookup local ip address

wget file –Download file


netstat -tupl –Listing all active listening     ports.

 

INSTALL PACKAGE COMMANDS:

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

 

HARDWARE COMMANDS:

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

 

USER COMMANDS:

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”

 

FILE PERMISSION RELATED COMMANDS:

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.

 

COMPRESSION/ARCHIVES COMMANDS:

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


 

DISC USAGE COMMANDS:

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

DIRECTORY TRAVERSE COMMANDS:

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


How to Install Ubuntu/Linux Operating System in your PC

Nowadays one of the best-operating systems is Ubuntu/Linux by using USB or Pendrive here step by step installation of Ubuntu/Linux with Pictures.

Step1: By Using USB Drive or Pendrive
Most newer computers can boot from USB.you might need to press the F12(or depends upon machine) key to bring up the boot menu

Step2: Prepare to Install Ubuntu for Download updates or third-party installing 

Step3: Click on Ubuntu Software whether to select all the options or what we need to select it

Step4: Allocate drive space here little bit more focus on it because one option Erase disk and Install Ubuntu it clear all files. If you have any operating system please copy all files into another disk otherwise will lose data

Step5: If Error Comes to Go back




Step6: Select your  present location(Geographical)

 

Step7: Select your preferred keyboard layout whether you are from the US or any other language please select it.

Step8: Enter your login and password details. Here Install as superuser so must and should give your name, computer’s name and choose a password as per your convince. Finally, click on Require my password to log in.

Step 9: After completion of the above steps: Install Complete-Restart System it means that successfully installation of your Ubuntu/Linux operating system in your PC.

Step 10: After Restart your Ubuntu/Linux operating system ask your PC password as per your credentials open your operating system.

Above steps are very simple to Install of Ubuntu/Linux operating system in your laptop after that open your dashboard. Open terminal check version and packages.