Sunteți pe pagina 1din 6

Basic Commands 1.

ls -l for listing the files as well as directories those are kept in the particular working directory syntax [root@nettech root]#ls -l .ls -la files. same as !ls -l!"ut "y this command we can also see the hiden

syntax [root@nettech root]#ls -la #.ls -li same as !ls -la! "ut it will also shows us the inode num"er of each and e$ery file syntax [root@nettech root]#ls -li %.ls "y this command we can see only file name nothing else

syntax [root@nettech root]#ls &.clear it will clear the screen'short cut ctl(l)

syntax [root@nettech root]#clear *.exit to end a current session as well current terminal logging

syntax [root@nettech root]exit +.touch to create a new empty file

syntax [root@nettech root]#touch ,.cd to change the working-present directory

syntax [root@nettech root]#cd -home-mango where !-home-mango! is the desired directory to "e change from !-root! ..cat to $iew the contents of a file and it is also used for creating a new file with some contents

syntax [root@nettech root]#cat /file name0

to $iew file contents

[root@nettech root]#cat 0 newfilename enter1then you can write something in the file and then to sa$e the file contents press clt(d then enter 12.mkdir syntax [root@nettech root]#mkdir newdirname you can also create a directory at your desired path without changing your present working directory syntax [root@nettech root]#mkdir -home-mango-newdirname 11.rm to remo$e a empty file to make a new directory

syntax [root@nettech root]#rm filename 1 .rmdir to remo$e a empty directory

syntax [root@nettech root]#rmdir directoryname 1#.rm [-i--r--f] to remo$e a directory with its su"directories as well as its files that is to remo$e a directory which already contains some files in it syntax [root@nettech root]#rm -i directory-filename -i stands for interacti$ely -r stands for recursi$ely -f stands for forcefully 1%.cp syntax [root@nettech root]#cp sourcepath destinationpath example3 [root@nettech root]#cp -home-mango-we"min.rpm -root-a"cd in this example the we"min.rpm file will "e copied in -root-a"cd directory to copy something in a destination file or directory

1&.m$ to mo$e one file or directory from one place to another place1 it is also used for renaming adirectory or file . 4yntax [root@nettech root]#m$ source destination [root@nettech root]#m$ oldfilename newfilename 1*.man [to change the file name]

to $iew the mannual page of commands for syntax

syntax [root@nettech root]#man commandname 1+.info to $iew the information a"out any command

syntax [root@nettech root]#mkdir info 1,.--help to $iew the help doccuments of a command

syntax [root@nettech root]#commandname --help 1..dir to $iew the su"directories and filesn under the directory

syntax [root@nettech root]#dir 2.su to "ecome a super user

syntax [mango@nettech mango]5su output wil "e [root@nettech root#] 1.who "y this command you can see the user name and their ip addresses who ha$e loged in on your ser$er . 4yntax [root@nettech root]#who .whoami this command shows your current logged in terminal user name

syntax [root@nettech root]#whoami #.who am i this command shows you the logged in terminal num"er and user

name and more detailed information

syntax [root@nettech root]#who am i %.pwd to $iew the present working directory

syntax [root@nettech root]#pwd &.rpm -i$h to intall a rpm package

syntax [root@nettech root]#rpm -i$h packagename.rpm rpm stands for !redhat package manager! -i stands for install -$ stands for $er"ose mode -h stands for with hash sign'#) *.rpm -6 to 6uerry a"out any rpm package

syntax [root@nettech root]#rpm -6 packagename +.rpm -e to uninstall a rpm package

synatx [root@nettech root]#rpm -e package ,.find - -name to find any file or directory in linux file system syntax [root@nettech root]#find - -name filename ..su username to switch from one user to another users home directory syntax [root@nettech root]#su mango output will "e [mango@nettech root]#cd [mango@nettech mango]# #2.su - username directory directly to switch from one user to another user users home

syntax [root@nettech root]#su - mango

#1.useradd

to create a new user

synatx [root@nettech root]#useradd username # .passwd to gi$e a password of a user

syntax [root@nettech root]#passwd tarun output will "e gi$e a password for user tarun3'here you ha$e to type a password for tarun user) confirm password3'again type the same password) ##.userdel to remo$e a user from linux

syntax [root@nettech root]#userdel tarun #%.groupadd to add a new group

syntax [root@nettech root]#groupadd groupname #&.gruopdel to delete a group

syntax [root@nettech root]#groupdel groupname #*.chown to change the ownership of a file or directory

syntax [root@nettech root]#chown ownername filename #+.chgrp to change the group ownership of a file or directory

syntax [root@nettec root]#chgrp newgroupownername filename example [root@nettech -]#ls -l drwxrw-rwtarun root %2.* 7ar 11 1 32# a"cd

[root@nettech root]#chgrp tarun -a"cd effect [root@nettech -]#ls -l drwxrw-rwtarun tarun %2.* 7ar 11 1 32# a"cd

#,.chmod drwxrw-rw-

to change the permission of a file or directory root root %2.* 7ar 11 1 32# a"cd 'name) 9:

'permission) 'ownr) 'grpownr) 'si8e) ;C<=> ?=>@A d stands for directiry r stands for read only permission w stands for write only permission x stands for execute only permission drwxrw-rwA<C.

BA=CD% EB9<AD AFAC@<AD1

G9B4< ;C<A< G;B CA:;<9:H <IA C9BAC<;BJ ;B G9>A ;B >9:K G9>A

4AC;:C <IBAA ;C<A< G;B @4AB ;B ;E:AB LAB79449;: 'rwx ;B + 9: ;C<=> ?=>@A) <I9BC <IBAA ;C<A< G;B HB;@L LAB79449;: 'rw- ;B * 9: ;C<=> ?=>@A) G;B<I <IBAA ;C<A< G;B ;<IAB4 LAB79449;: 'rw- ;B * 9: ;C<=> ?=>@A) 4J:<=F [root@nettec root]#chmod $alue fileordirectoryname example [root@nettech -]#ls -l drwxrw-rwtarun root %2.* 7ar 11 1 32# a"cd

[root@nettech -]#chmod %2 -a"cd [root@nettech -]#ls -l drw-----w%2.usermod tarun tarun %2.* 7ar 11 1 32# a"cd

to modify the user profile

synatx [root@nettech root]#usermod -parameter groupname username Lage &

S-ar putea să vă placă și