exit
logout
ctrl + d
$touch
$cat
$echo “hakki al saidi” -- display the text
$echo “hakki al saidi”>newfile -- display the text and put it in text file
named newfile
$cat /etc/passwd > myfile -- display the contain of passwd file and put
it in text file named myfile
$ls --display the contain of current directory
$shutdown
$shutdown –r
$halt --for emergent case only
$init 6 --restart
$init 0 --shutdown
$poweroff
$mkdir
$pwd --to see the directory
$cp newfile1 ../newfile2 -- to copy file from the current location to root
$ mv newfile1 newfile2 --move newfile1 and rename it to newfile2
$ mv newfile1 ./newdir/ -- move newfile1 to directory newdir in same
name
$cat newfile1 -- to read file
$more newfile1
$rm newfile1 --to delete file
$rm –r newdir --to delete directory
$rm –fr newdir --to delete directory without prompt
$less filename
$cat file1 file2 file3 -- to open all these files in same time
Changing permission
$chmod
$chmod u-w bin -- u = user
$chmod g + rx bin
For example: chmod -R 775 /u01/app/oracle
$chmod u = rwx , g = r-x , o = -- u=user g=group o=other
$chmod 750 bin -- 7=111=rwx, 5=101=r-x, 0=000=---
Change owner
$chown
Change owner of diractory and all contian
$chown -R
$chown -R hakki ./newdir/
Change mode
$chmod
$chmod u=r-x , g=rwx , o=
u user
g group
o other
$chmod g+rw
$chmod 755
7 rwe
5 r-e
chmod -R 775 /u01/app/oracle
Change group
$chgrp
Change group and all contain
$chgrp -R
In which user you are
$whoami
Whose users are login
$who
The type of file
$file
If you want search on file you know it's name and you don’t know the diractory
$find ./-name
$find ./-name passwod
If you want to know the path of command
$which
$which ls
Variables
=
$var1="hakki"
$echo $var1 --the output hakki
To see the contain of path
$echo $PATH
To unset variable
$unset
$unset var1
To add another directory to path
$PATH=dir:$PATH
$PATH=/root/myls:$PATH
To know the current shell
$echo $shell
To see the available shells
$cat /etc/shells
To change to anther shell
only write the shell name
$bash
To exit from shell
exit
To sharing between shells use
$export
$export var1="hakki"
Links like shortcut in window
To see the information about inode
$ls -li
1-hard link
To make hard link to file
$ln file link
$ln new_file hard_link
2-soft link
$ln -s file link
$ln -s new_file soft_link
To display the contain of hard link
$cat link
To write text in file
$echo "this is my text">new_file
To add text in file
$echo "my name is hakki">>new_file
Output Redirection
$command1>new_file --to write the result in text file
$command1>>new_file --to append the result in text file
Input
$command1 input_new_file
$sort input_new_file
Display contain file sorted and save result in another file
$command1 input_new_file output_new_file
$sort input_new_file output_new_file
To pass the output of command to another command
$ls /etc more
Change prompt
We can use the variable PS1 to change prompt
$PS1=”my prompt”
Export PS1 -- to share this prompt between session
PS1=”[\u!@\h][\w]” -- u = the use , h = machine name ,w = full path
In IBM server
vi ~/.profile
--write in profile
export PS1="[`hostname`][`whoami`]\$PWD\> "
--execute it
Visual editor
1- the command mode
2- the insert mode
$vi –R filename -- to open file for read only
$view filename -- to open file for read only
To move
K
H
L
J
5L -- move corser five character
8J -- move the courser eight lines down
$ -- to go to end of line
0 -- to go to begin of current line
w next word
b previous word
ctrl + F foreword one page
ctrl + B Back one page
G last line
:q! exit
:1 first line
:9 ninth line
6G line number 6
:set nu to number the page
:set nonu to remove line number
Shift + G to go to the end of text file
Insert mod
-To go to insert mode
i it well type before cursor
a it well type after cursor
I it well type in the beginning of line
A it well type in the end of line
Search files
In command mode
/
n find next
N find previous
? text to be search
SAVE AND EXIT
:q exit
:w save in same name
:wq save and exit
:q! force exit
:zz save and exit
:w
:e! last version successful of save file [refresh]
DELETE CHARACTER
We must be in command mode
x delete single character under cursor
5x delete five char from cursor
X backslash
dw delete one word
D delete form cursor to end of line\
u undo
dd delete all line
CHANGE COMMAND
cc delete line and take you in insert mode
cw delete the word
r replace the character
R start over writing
s start over writing in insert mode
S delete currant line in insert mode
J join two line
yy copy line to buffer
p past
yw copy word
P past above line
o Create line below and take you in insert mode
O Create line above and take you in insert mode
Ctrl + G information about file
:! To execute command in text file without exit from it ;
FIND AND REPLACE TEXT
Change will be done above cursor
:s /
Change all file
:1,$s: /
:1,$s/FEB/MAR/g
1 first file
$ end file
c confirm ask
meta character
1. (*)
rm –fr *
delete all file in the directory
2. (.)
rm -fr c.t
delete all file start with c and end with t and one character between them
rm -fr c*t
delete all file start with c and end with t and any number of character between them
3. ([])
rm -fr c[ioa]t
delete all word start with c and end with t and there is one letter between them i or o or a
4.(^) not
rm –fr c[^aio]t
delete all files start with c and end with t and the letter between two bracket
not in them
4. (^)
rm –fr ^c.t
Delete all files begin with c follow by any character and third character is t
rm -$
delete all line
FTP File Transfer protocol
ftp
ftp
user name:
password:
FTP> LS list contain of directory
To start FTP
service vsftpd status
service vsftpd start
service vsftpd status
Grep Command
-To search any string inside file
grep string filename
-to display all file that not contain root
grep –v root /etc/*
Find command
-to search file and directory
find .-filename passwd –print
to run Xprocess
vi /etc/X11/gdm/gdm.comf
xdmcp=true
to change host name
vi /etc/hosts
add:
IP HOSTNAME
To change the password
passwd
to change the time and date
root>man date
root> [MMDDhhmm[[CC]YY][.ss]]
root>date 1101121807
date 11171543
root> while (true)
> do
> date
> sleep 2
> done
TO SET THE EDITOR IN IBM
set -o vi
%
% setenv EDITOR vi
%
% ksh
$
$
$
$ set -o vi
Esc + K
CREATE USER
/usr/sbin/useradd rozhan
passwd rozhan
chmod -R 775 /uid01/app/oracle/product/10.2.0/db_1/admin/itappsdb/bdump/alert_itappsdb.log
to extract file format cpio
cpio -idvm < as_linux_x86_portal_wireless_101202_disk1.cpio
to update the time
ntpdate -s -b -p 8 -u 192.168.163.1
to monitor the command executed in background
tail -f nohup.out
to start ftp
[root@cdrsub ~]# service vsftpd status
vsftpd is stopped
[root@cdrsub ~]# service vsftpd start
nohup.out
to run the script
nohup ./exp_2006_2005.sql &
to check the package install
rpm –q package name
exp:
rpm –q elfutils-libelf-devel-0.97
to install the package
rpm -Uvh package name
exp:
rpm -Uvh unixODBC-devel-2.2.11-1.RHEL4.1.i386.rpm
to uninstall package
rpm -e package name
exp:
rpm -e oracleasmlib-2.0.2-1
to search file
find / -name filename
exp:
find / -name ora_control1
No comments:
Post a Comment