- ls -l for listing the files as well as directories those are kept in the particular working directory
[root@armourinfosec ~]# ls โl
- ls -la same as ‘ls -l’ but by this command we can also see the hidden files
[root@armourinfosec ~]#ls โla
- ls -li same as ‘ls -la’ but it will also shows us the inode number of each and every file
[root@armourinfosec ~]#ls โli
- ls by this command we can see only file name nothing else
[root@armourinfosec ~]#ls
- clear it will clear the screen ( short cut ctl + l )
[root@armourinfosec ~]#clear
- exit to end a current session as well current terminal logging
[root@armourinfosec ~]#exit
- touch to create a new empty file
[root@armourinfosec ~]#touch myfile.txt
- cd to change the working/present directory
[root@armourinfosec ~]#cd /home/sachin
- cat to view the contents of a file and it is also used for creating a new file with some contents
[root@armourinfosec ~]#cat <file name> to view file contents
[root@armourinfosec ~]#cat > newfilename enter, then you can write something in the file and then to save the file contents press clt+d then enter
- mkdir to make a new directory
[root@armourinfosec ~]#mkdir newdirname
you can also create a directory at your desired path without changing your present working directory
[root@armourinfosec ~]#mkdir /home/sachin/newdirname
- rm to remove a empty file
[root@armourinfosec ~]#rm filename
- rmdir to remove a empty directory
[root@armourinfosec ~]#rmdir directoryname
- rm [-i/-r/-f] to remove a directory with its subdirectories as well as its
files that is to remove a directory which already contains some files in it
[root@armourinfosec ~]#rm -i directory/filename
-i stands for interactively
-r stands for recursively
-f stands for forcefully
- cp to copy something in a destination file or directory
[root@armourinfosec ~]#cp sourcepath destinationpath
[root@armourinfosec ~]#cp /home/sachin/webmin.rpm /root/abcd
in this example the webmin.rpm file will be copied in
/root/abcd directory
- mv to move one file or directory from one place to another place, it is also used for renaming adirectory or file
[root@armourinfosec ~]#mv source destination
[root@armourinfosec ~]#mv oldfilename newfilename [to change the file name]
- man to view the mannual page of commands for syntax
[root@armourinfosec ~]#man commandname
- info to view the information about any command
[root@armourinfosec ~]#mkdir info
- –help to view the help doccuments of a command
[root@armourinfosec ~]#commandname โhelp
- dir to view the subdirectories and filesn under the directory
[root@armourinfosec ~]#dir
- who by this command you can see the user name and their ip addresses who have loged in on your server
[root@armourinfosec ~]#who
- whoami this command shows your current logged in terminal user name
[root@armourinfosec ~]#whoami
- who am i this command shows you the logged in terminal number and user name and more detailed information
[root@armourinfosec ~]#who am i
- pwd to view the present working directory
[root@armourinfosec ~]#pwd
- rpm -ivh to intall a rpm package
[root@armourinfosec ~]#rpm -ivh packagename.rpm
rpm stands for ‘redhat package manager’
-i stands for install
-v stands for verbose mode
-h stands for with hash sign(#)
- rpm -q to querry about any rpm package
[root@armourinfosec ~]#rpm -q packagename
- rpm -e to uninstall a rpm package
[root@armourinfosec ~]#rpm -e package
- find / -name to find any file or directory in linux file system
[root@armourinfosec ~]#find / -name filename
- su username to switch from one user to another users home directory
[root@armourinfosec ~]#su sachin
- su – username to switch from one user to another user users home directory directly
[root@armourinfosec ~]#su โ sachin
- useradd to create a new user
[root@armourinfosec ~]#useradd username
- passwd to give a password of a user
[root@armourinfosec ~]#passwd sachin
give a password for user sachin:(here you have to type a password for sachin user) Confirm password:(again type the same password)
- userdel to remove a user from linux
[root@armourinfosec ~]#userdel sachin
- groupadd to add a new group
[root@armourinfosec ~]#groupadd groupname
- gruopdel to delete a group
[root@armourinfosec ~]#groupdel groupname
- chown to change the ownership of a file or directory
[root@armourinfosec ~]#chown ownername filename
- chgrp to change the group ownership of a file or directory
[root@armourinfosec ~]#chgrp newgroupownername filename
- usermod to modify the user profile
[root@ armourinfosec ~]#usermod -parameter groupname username