File System Navigation and Basic linux commands

File System Navigation and Basic linux commands
cd
cd .. - one step backwords
cd ~/ - home directory
d--------- means directory
---------- means file
pwd -print working directory

ls
ls -a - provides all hiden files
ls -l  long listing
ll
less - open file
ls -h  humun readable format
ls -R  recurssive
ls --help


man ls  manual pages
man --help
locate
find
locate is faster that find but for that database has to be updated

touch <filename or provide with path>

find (u can use find only if u know where something is in specific)
u don't use find which go through entire system bcz it takes long while thats why we use locate which search through
database and is much faster

find /home -name neelu
find <directory> -name <filename>
linux is case sensitive
argument -i  ignore case
find /home -namei neelu
if general user search for a file from not in his home directory without specifying directory then it throws permission denied errors

find <filename>

locate <filename or filename with path>
locate -i <filename>
locate uses a database and it has to be updated on daily basis which is resource inexpensive and inefficinet
later developers cms with nyc option
updatedb (it has to be run with root cmd)
result : all files with that particular pattern are shown
locate -b <path> -name <filename>
files in that particular path are shown

file and folder permissions

cmd : owner : group : world : path
---  2^2 2^1 2^0
4-read (r)
2-write (w)
1-execute (x)
7(4+2+1) rwx
6(4+2) rw-
5(4+1) r-x
4(4) r--
3(2+1) -wx
2(2) -w-
1(1) --x

w- modify contents of file not the permissions which can be changed by owner of the file
chmod for changing permissions

chmod 564 <filename>
owner - r-x
group - rw-
world - r--
chmod +w <filename>
chmod -w <filename>
this applicable to owner and the group he belongs to
chmod --help
-R change files and directories recursively
chmod -R +x <path>

use no's is a better way of changing permissions

touch - to create empty files


change ownership of file from one user to onther and one group to other

chown - change ownership

chown --version
is same for all programs u operate in linux
chown <ownername>:<groupname> <filepath>
chown -v <ownername>:<groupname> <filepath>  for verbose o/p

remove files

rm
it is not like in windows
rm -rf or rm -Rf
rm -f

cp <source> <dest>

mv <orgi_filename> <new_filename>
used to renaming things

mv <source> <dest>
move files from one location to other location


echo hi
o/p : hi

echo hey there how are you > echo
cat echo

> - redirect o/p and delete the old contents
>> - redirect o/p and insert the lines but not delete old contents

\"  - escape character tells don't interpret it "
echo "how did you do your test\"
o/p
>
> "
how did you do your test"

echo -e "hi \n how r u \n i am fyn \n how do you do"
e- enables intrepretation of backslash escapes

pipe : | - means pass along
grep <search word>

vim <filename> | grep -i hi
i - ignore cases


yum packet manager

a packet manager is piece of code which enables you pool from remote locations (repositiries) any piece of code with in that repo and
install it

yum install <package name> or <package>
yum search <package name> or <package>

for cent os and redhat it uses rpm package

list of cmnds u can pass through yum
downgrade
deplist - dependancy list
install
search
info  - about the packages
update
repolist

yum -C repolist
C - give me what i need


yum update
yum upgrade
yum reinstall gedit
yum reinstall gedit -y
yum info gedit
yum remove gedit

RPM packet manager

rpm --help
rpm -ivh <package>
i install
v verbose
rpm -e <package>
eerase
rpm -q <package>
q  query
rpm --help | grep "\-e"




























































Comments

Popular posts from this blog

DOMAIN AND SSL