• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Basic commands
 

Basic commands

on

  • 160 views

 

Statistics

Views

Total Views
160
Views on SlideShare
160
Embed Views
0

Actions

Likes
0
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Basic commands Basic commands Document Transcript

    • Basic Commands1.ls -l for listing the files as well as directories those are kept inthe particular working directorysyntax[root@nettech root]#ls -l2.ls -la same as ls -lbut by this command we can also see the hidenfiles.syntax[root@nettech root]#ls -la3.ls -li same as ls -la but it will also shows us the inode number ofeach and every filesyntax[root@nettech root]#ls -li4.ls by this command we can see only file name nothing elsesyntax[root@nettech root]#ls5.clear it will clear the screen(short cut ctl+l)syntax[root@nettech root]#clear6.exit to end a current session as well current terminal loggingsyntax[root@nettech root]exit7.touch to create a new empty filesyntax[root@nettech root]#touch8.cd to change the working/present directorysyntax[root@nettech root]#cd /home/mangowhere /home/mango is the desired directory to be change from/root9.cat to view the contents of a file and it is also used for creating anew file with some contentssyntax[root@nettech root]#cat <file name> to view file contents[root@nettech root]#cat > newfilename enter,then you can write something inthe file and then to save the file contents press clt+d then enter10.mkdir to make a new directorysyntax[root@nettech root]#mkdir newdirnameyou can also create a directory at your desired path withoutchanging your present working directorysyntax[root@nettech root]#mkdir /home/mango/newdirname11.rm to remove a empty filesyntax[root@nettech root]#rm filenamePage 1
    • Basic Commands12.rmdir to remove a empty directorysyntax[root@nettech root]#rmdir directoryname13.rm [-i/-r/-f] to remove a directory with its subdirectories as well as itsfiles that is to remove a directory which already contains some files in itsyntax[root@nettech root]#rm -i directory/filename-i stands for interactively-r stands for recursively-f stands for forcefully14.cp to copy something in a destination file or directorysyntax[root@nettech root]#cp sourcepath destinationpathexample: [root@nettech root]#cp /home/mango/webmin.rpm /root/abcdin this example the webmin.rpm file will be copied in/root/abcd directory15.mv to move one file or directory from one place to another place, itis also used for renaming adirectory or filesyntax[root@nettech root]#mv source destination[root@nettech root]#mv oldfilename newfilename [to change the file name]16.man to view the mannual page of commands for syntaxsyntax[root@nettech root]#man commandname17.info to view the information about any commandsyntax[root@nettech root]#mkdir info18.--help to view the help doccuments of a commandsyntax[root@nettech root]#commandname --help19.dir to view the subdirectories and filesn under the directorysyntax[root@nettech root]#dir20.su - to become a super usersyntax[mango@nettech mango]$su -output wil be[root@nettech root#]21.who by this command you can see the user name and their ip addresseswho have loged in on your serversyntax[root@nettech root]#who22.whoami this command shows your current logged in terminal user namesyntax[root@nettech root]#whoami23.who am i this command shows you the logged in terminal number and username and more detailed informationPage 2
    • Basic Commandssyntax[root@nettech root]#who am i24.pwd to view the present working directorysyntax[root@nettech root]#pwd25.rpm -ivh to intall a rpm packagesyntax[root@nettech root]#rpm -ivh packagename.rpmrpm stands for redhat package manager-i stands for install-v stands for verbose mode-h stands for with hash sign(#)26.rpm -q to querry about any rpm packagesyntax[root@nettech root]#rpm -q packagename27.rpm -e to uninstall a rpm packagesynatx[root@nettech root]#rpm -e package28.find / -name to find any file or directory in linux file systemsyntax[root@nettech root]#find / -name filename29.su username to switch from one user to another users home directorysyntax[root@nettech root]#su mangooutput will be[mango@nettech root]#cd[mango@nettech mango]#30.su - username to switch from one user to another user users homedirectory directlysyntax[root@nettech root]#su - mango31.useradd to create a new usersynatx[root@nettech root]#useradd username32.passwd to give a password of a usersyntax[root@nettech root]#passwd tarunoutput will begive a password for user tarun:(here you have to type a password for tarun user)confirm password:(again type the same password)33.userdel to remove a user from linuxsyntax[root@nettech root]#userdel tarunPage 3
    • Basic Commands34.groupadd to add a new groupsyntax[root@nettech root]#groupadd groupname35.gruopdel to delete a groupsyntax[root@nettech root]#groupdel groupname36.chown to change the ownership of a file or directorysyntax[root@nettech root]#chown ownername filenameexample:[root@nettech /]#ls -loutputdrwxrw-rw- 2 root root 4096 Mar 11 12:03 abcd(permission) (own) (group own)(size) (name)[root@nettech root]#chown tarun /abcdin this example /abcd directory owner will be change to tarun usereffect[root@nettech /]#ls -ldrwxrw-rw- 2 tarun root 4096 Mar 11 12:03 abcd37.chgrp to change the group ownership of a file or directorysyntax[root@nettec root]#chgrp newgroupownername filenameexample[root@nettech /]#ls -ldrwxrw-rw- 2 tarun root 4096 Mar 11 12:03 abcd[root@nettech root]#chgrp tarun /abcdeffect[root@nettech /]#ls -ldrwxrw-rw- 2 tarun tarun 4096 Mar 11 12:03 abcd38.chmod to change the permission of a file or directorydrwxrw-rw- 2 root root 4096 Mar 11 12:03 abcd(permission) (ownr) (grpownr) (size) (name) INOCTAL VALUEd stands for directiry READ=4r stands for read only permission WRITE=2w stands for write only permission EXECUTE=1x stands for execute only permissiondrwxrw-rw- FIRST OCTET FOR DENOTING THE DIRECTORY OR FILE OR LINK FILE ETC.SECOND THREE OCTET FOR USER OR OWNER PERMISSION (rwx OR 7 INOCTAL VALUE)THIRD THREE OCTET FOR GROUP PERMISSION (rw- OR 6 IN OCTAL VALUE)FORTH THREE OCTET FOR OTHERS PERMISSION (rw- OR 6 IN OCTAL VALUE)SYNTAX[root@nettec root]#chmod value fileordirectorynameexample[root@nettech /]#ls -ldrwxrw-rw- 2 tarun root 4096 Mar 11 12:03 abcd[root@nettech /]#chmod 402 /abcd[root@nettech /]#ls -ldrw-----w- 2 tarun tarun 4096 Mar 11 12:03 abcd40.usermod to modify the user profilePage 4
    • Basic Commandssynatx[root@nettech root]#usermod -parameter groupname usernamePage 5