Saturday, February 25, 2012

Performing basic tasks on CentOS 5

to see the current dirctory


pwd

/home/sourav



ls

Desktop

(it's directory not file as it is in blue colour)


cd Desktop

ls

cd ..

to go one level up

(tab for command completion)

cat > a.txt
Hellow how are you?

ctrl + z




ls -a for showing files starting with .


in linux user home directories generally starts with .

man and info command shows info about commands


for example



man ls

press space for more(scroll down)


press b for scrol up


press q to quit

ls

a.txt

cp a.txt b.txt

ls


a.txt b.txt

up arrow for previous commands
move or
mv filename newfilename
to create directory use mkdir directory name
to delete directory use rmdir directory name
to delete a non-empty directory
rm -r directory name

ls -l for long listing
In info command you can search like to search in emacs editor

info ls


type ctrl + s
 
type long to search long word in the info document

ctrl + g to exit out of searching in the document

q to quit

ls -al combines 2 command

In man command you can search like to search in vi editor
type a slash(/)
and the prompt will change to / from :

type the search string such as long
now press n to find the next instance where the word "long" is present in the
man document

find any command contaning any particular word

example

man -k jpg

cd /


takes us to the toppest level directory

there type ls to know about linux directories

bin directory contains executable binary files


boot directory holds the files needed for booting

home is for users

opt directory is for optional softwares


root is root user's home directory


many people call the / directory the root directory






sbin directory holds executable binary files such as system tools(can be used




by system admins)

in usr directory there is also /bin and /sbin directory
any executable generally resides in /bin or /usr/bin directory
any executable that is a system utility generally resides on /sbin or /usr/sbin
directory
in your user home directory there will be files ending with tilda(~) sign
such as
.bash_profile~
they are the old configuration
the newer configuration files will be without tilda(~),in case the newer files
got messed up
creating an alias

cd /home/sourav

vi .bashrc


press i


type
alias rm='rm -i'


:wq to save the file


type

source .bashrc

to active the change immediately and try deleting something with rm
to add a custom application launcher

system-preference-more preference-menu layout

then click new item

write the name of the application and the command to initiate it
close it

then you will see the application in the application drop down menu bar

to install a rpm

rpm -ivh packagename.rpm

to uninstall a rpm

rpm -e packagename.rpm

to untar a tar file

tar xvf packagename.tar

install apache

yum install httpd


start apache server


/etc/init.d/httpd start


to restart


/etc/init.d/httpd restart


No comments:

Post a Comment