Linux Simple Notes
Linux Simple Notes
Linux Simple Notes
com/in/vijaykumar-biradar-29b710161/
Unix Vs Linux
Today Linux is in great demand. You can see the use of Linux everywhere. It's dominating on
our servers, desktop, smartphones and even used in some electrical devices like refrigerators.
Some people think Unix and Linux as synonyms, but that's not true. Many operating systems
were developed to be like Unix but none of them got the popularity as Linux. Linux is the clone
of Unix. It has several features similar to Unix, still have some key differences. Before Linux
and Windows, computer world was dominated by Unix. Unix is a copyrighted name and IBM
AIX, HP-UX and Sun Solaris are only Unix operating system remained till date.
Examples It has different distros like Ubuntu, IBM AIX, HP-UX and Sun Solaris.
Redhat, Fedora, etc
Users Nowadays, Linux is in great demand. It was developed mainly for servers,
Anyone can use Linux whether a home workstations and mainframes.
user, developer or a student.
Usage Linux is used everywhere from servers, It is used in servers, workstations and
PC, smartphones, tablets to mainframes PCs.
and supercomputers.
GUI Linux is command based but some Initially it was command based OS,
distros provide GUI based Linux. Gnome but later Common Desktop
and KDE are mostly used GUI. Environment was created. Most Unix
distributions use Gnome.
Interface The default interface is BASH (Bourne It originally used Bourne shell. But is
Again SHell). But some distros have also compatible with other GUIs.
developed their own interfaces.
File system Linux supports more file system than It also supports file system but lesser
support Unix. than Linux.
Coding Linux is a Unix clone,behaves like Unix Unix contain a completely different
but doesn't contain its code. coding developed by AT&T Labs.
Security It provides higher security. Linux has Unix is also highly secured. It has
about 60-100 viruses listed till date. about 85-120 viruses listed till date
Linux mint It works like windows and should be use by new comers.
OpenSUSE It works same as Fedora but slightly older and more stable.
Arch Linux It is not for the beginners because every package has to be installed by
yourself.
dmesg
cat /proc/cpuinfo
free -h
lshw
See information about block devices:
lsblk
lspci -tv
lsusb -tv
dmidecode
hdparm -i /dev/disk
badblocks -s /dev/[device]
Searching
Search for a specific pattern in a file with grep:
grep [pattern] [file_name]
locate [name]
File Commands
List files in the directory:
ls
ls -a
mkdir [directory]
Remove a file:
rm [file_name]
rm -r [directory_name]
rm -rf [directory_name]
cp [file_name1] [file_name2]
cp -r [directory_name1] [directory_name2]
mv [file_name1] [file_name2]
Create a symbolic link to a file:
ln -s /path/to/[file_name] [link_name]
touch [file_name]
more [file_name]
cat [file_name]
head [file_name]
tail [file_name]
Encrypt a file:
gpg -c [file_name]
Decrypt a file:
gpg [file_name.gpg]
wc
Directory Navigation
Move up one level in the directory tree structure:
cd ..
cd
cd /chosen/directory
File Compression
Archive an existing file:
gzip [file_name]
File Transfer
Copy a file to a server directory securely:
Synchronize the contents of a directory with a backup directory using the rsync
command:
Users
See details about the active users:
id
last
Display who is currently logged into the system with the who command:
who
groupadd [group_name]
adduser [user_name]
Temporarily elevate user privileges to superuser or root using the sudo command:
sudo [command_to_be_executed_as_superuser]
Delete a user:
userdel [user_name]
usermod
Package Installation
List all installed packages with yum:
rpm -i [package_name.rpm]
Process Related
See a snapshot of active processes:
ps
pstree
pmap
top
kill [process_id]
Terminate a process under a specific name:
pkill [proc_name]
killall [proc_name]
bg
fg
fg [job]
lsof
System Information
Show system information:
uname -r
Display how long the system has been running, including load average:
uptime
hostname
hostname -i
last reboot
date
timedatectl
cal
List logged in users:
whoami
finger [username]
Disk Usage
See free and used space on mounted systems:
df -h
df -i
fdisk -l
du -ah
findmnt
Mount a device:
SSH Login
Connect to host as user:
ssh user@host
ssh host
telnet host
File Permission
Chown command in Linux changes file and directory ownership.
Assign read, write, and execute permission to everyone:
Give read, write, and execute permission to owner, and read and execute permission to
group and others:
Assign full permission to owner, and read and write permission to group and others:
Network
List IP addresses and network interfaces:
ip addr show
netstat -pnltu
netstat -nutlp
whois [domain]
dig [domain]
dig -x host
dig -x [ip_address]
host [domain]
Show the local IP address:
hostname -I
wget [file_name]
Ctrl + C
Ctrl + Z
The process can be resumed in the foreground with fg or in the background with bg.
Ctrl + W
Cut part of the line before the cursor and add it to clipboard:
Ctrl + U
Cut part of the line after the cursor and add it to clipboard:
Ctrl + K
Paste from clipboard:
Ctrl + Y
Ctrl + R
Ctrl + O
Ctrl + G
!!
exit