Unix like operating system

Unix is an operating system.


It was developed in the 1970s at the 
Bell Labs research center by Ken ThompsonDennis Ritchie, and others.  

Today there are more than 400 standard operating systems based on unix operating system (They are called unix like operating system) such as Linux, 
Redhat, 
Ubuntu, 
Fedora, 
Kali, 
Macintosh, 
and more. 
Its mean if you know any one unix kernel based operating system you can operate all 400 standard operating systems.





Unix commands

ls : To list all folders and files of current directory

ls -l : To list all folders and files of current directory with more details (with permissions and stuff)

mkdir : To create an new directory in current path

touch : To create a new file

rm <YourFileName> : To delete your file

rm -rf <YourDirectoryName> : To delete your complete folder  

cd : To change directory (go to inside a directory)

cd .. : To come back one directory

clear : To clear screen

pwd : To check present working directory

nano <YourFileName> : To add content in your file (Nano is a text editor)

cat : To list content from the file

vim (It's a most powerful text editor) has three modes

1) Command mode
 (press esc)
5dd It will delete 5 lines from file
2yy It will copy 2 lines from file 
It will paste copied lines in current position of cursor

2) Insert mode (press esc and "i") 
then insert whatever data you want  

3) Ex mode  (press esc key and colon) 
:wq To save and exit
:q! To exit without save




cp: To copy a file
cp file1 file2

mv: To rename a file
mv fil1 fil2

date: To get date and time

col: To check this months calender

w: To display who is online

diff: To compare two files contents
diff file1 file2

head: To display begining of the file
head file1

tail: To display end of the file
tail file1

less: To view the file
less file1

rmdir: To remove a directory

man command: To show manual of command

info command: It's same like man command but in more details.

whoami: To check who is currently logged in

uname -a: To show kernel config

cat /proc/cpuinfo: To check CPU information

cat /proc/meminfo: To check memory information

df: To show disk usage

du: To show directory space usage

free: To show memory and swap usage

whereis app: To show possible location of the app

which app: To show which app will be run by default

wget: To download a file from internet
wget -r https://github.com/in28minutes/CTutorialForBeginners.git

grep: To search for a string of characters in a specified file.
grep aleena file1

ping: To ping the host
ping www.aleenabagwan.blogspot.com

whois: To get whois of domain
whois www.sirajchaudhary.com

dig: To get DNS of the domain
dig www.sirajchaudhary.com






useradd: To create a new user
passwd: To create a password for newly added user
e.g.
useradd aliza
passwd aliza123

groupadd: To create a new group
e.g.
groupadd bagwan

adduser: To add an existing user to an existing group
e.g.
adduser aliza bagwan

chmod: To change permission of a file or folder (Here we set 7(111=rwx for user), 4(100=r-- for group), and 5(101=r-w for others))
chmod 745 /test.txt


chown: To change user ownership of a file
chown siraj test.txt

chgrp: To change group ownership of a file
chgrp bagwan test.txt

history: To see previously used commands (history)

init 0 (or poweroff): To shutdown the system

init 6 (or reboot): To restart the system

tar cf file.tar files: To create file.tar for the files
tar xf file.tar: To untar the tar into current directory
tar tf file.tar: To show contents of archieve

gzip file: To compres file and rename to file.gz
gzip -d file.gz: To uncompress

CTRL+C: To halt the current command
CTRL+Z: To stop the current command

ps: To display currently active processes
ps aux: ps with more details
kill pid: kill process with pid
killall proc: kill all process named proc

exit: To logout the current session





Comments

Post a Comment

Popular posts from this blog

Website Event Handling (JavaScript)

C Language