Professional Documents
Culture Documents
1 General
Command Syntax Whatis
command [option] [source file(s)] [target file] whatis <command> whatis grep man man ls
Manual
Directory Structure
Root /bin Commands that can be accessed by all users /boot Static boot loader files
/dev Device files /etc Host-specific configuration files /home User home directories /lib Shared libraries and kernel modules /mnt Mount point for temporary file systems /opt Add on application software /root Home directory for root user /sbin System binaries /tmp Temporary files /usr Shareable, read-only /var Variable data files User su <user_name>
Change User
Become root
su su -
exit whoami
Current user account
Navigation
Change Directory ... down one level Change Directory ... up one level Change To Root Directory
cd <directory_name> cd etc cd cd .. cd cd /
File Handling
Make Directory
mkdir <directory_name> mkdir morgan rmdir <directory_name> rmdir morgan rm -i <directory_name> cd $HOME ls -al mkdir morgan ls -al cd morgan mkdir subdir
Remove Directory
touch <file_name> touch psoug.ora rm <file_name> rm psoug.ora cp <old_name> <new_name> cp psoug.ora / cp -i <old_name> <new_name> cp psoug.ora / cp -ir <old_name> <new_name> cp -ir psoug.ora / scp <user_name>@<server_name>:<source_path_and_file_name > <target_path_and_file_name> scp oracle@bigdog:/home/oracle/*.gz . rm <file_spec> touch delfile
Remove A File
Secure CoPy
Delete
List
Move
touch myfile
Change Owner
Change Group
Change Mode
Triplets
Change Mode
111 222 333 444 555 666 777 124 644 755
666 555 444 333 222 111 000 653 133 022
Demo
Navigation Exercise
-- navigate to root directory cd / -- verify location pwd ls -l -- navigate to home directory cd home -- make a some directories mkdir morgan cd morgan pwd mkdir dest mkdir src
ls -l cd src pwd touch psoug ls -l mv psoug psoug.src mv psoug Environment Manipulation Rename a Linux server's name su
rename host server
uname
List hardware/operating system environment uname -a List environment variables for the current session Same as set. See export demo Sets environment variables set
env
export
set
List environment variables for the current session Same as env. See export demo $HISTSIZE $HISTSIZE
command history
cd $HOME cd / cd ~
tar <switches> <file_spec> <tarball_name> tar -cvf * beta1RAC.tar tar <switches> <file_spec> <tarball_name> tar -cxvf * beta1RAC.tar.gz tar <switches> <file_spec> <tarball_name> tar -xvf beta1RAC.tar tar <switches> <file_spec> <tarball_name> tar -zxvf beta1RAC.tar.gz jar <switches> <file_spec> <jar_name> jar -xf patch.jar cpio -ivf <file_name> cpio -idv < as_linux_x86_101300_disk1.cpio
Compressed TAR
Cron Commands
crontab cronfile
Submits jobs to be scheduled ? Makes changes to an existing chron schedule ? Submits jobs to be scheduled ?
crontab -e
crontab cronfile
Applications
Concatenate (CAT)
df <switches>
Disk Free Space
df -k df -m df -h (Linux only) echo <environment variable> echo $ORACLE_SID find . -name "<file_name>" -print find . -name "grep" -print find find . -name *.arc -type f -ctime +3 -exec rm {} \; find $WORKDIR -name "<filemask>" -mtime+<days> -exec rm {}\; find $WORKDIR -name "*.dat.*" -mtime + 14 -exec rm {} \; find . -name "<file_name>" -print find $ORACLE_BASE/admin/$ORACLE_SID -name "*.trc" mtime +7 -exec rm -f {} \; grep [-options] pattern [filename] grep iostat iostat more cd /etc more protocols
View environment variable's value Find Files Find archive logs older than 3 days and delete them
Find and delete trace files more than 7 days old Global regular expression print (GREP). Prints all lines matching a certain pattern Disk i/o Memory Statistics
More
Processes
System Activity
sar
Statistics (Paging)
Tee Splits the output of another command, sending it to a file and to the terminal.
top q
System Management
Wireless Configuration Shared Library Dependencies Display Loaded Kernel Modules Display Open Files Display Formatted Process Tree
iwconfig <switches> iwconfig wifi0 power off ldd <program_name> ldd ? lsmod lsmod lsof lsof pstree <switches> pstree -ca
User Management
Change Password
chage
and Expiration Information Force Password Change At Next Logon Create Group Display All Resource Limits for the Current User Display data about one or more users
chage ? chage chage -d0 groupadd <group_name> groupadd ulimit <switches> ulimit -a finger <switches> users finger -l oracle
vi
create a new file or open a file for editing quit without saving
vi vi initSID.ora :q! :q! :wq :wq Esc i i Esc A A Esc o o Esc r r Esc R R Esc x x Esc dd dd Esc dw
insert
append
open a new line replace a single character replace a multiple character s delete a single character delete line delete word
dw
undo
Esc u u
SQL*Plus Shell Script Demo -- log onto Linux as the user oracle
bash demo
-- verify the UNIX user [oracle@gamma2 home]$ whoami oracle -- log into Oracle as scott/tiger [oracle@gamma2 ~]$ sqlplus scott/tiger@orcl SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 20 17:18:37 2006 Copyright (c) 1982, 2005, Oracle. reserved. All rights
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, Real Application Clusters, OLAP and Data Mining options -- create a test table SCOTT@orcl > create table test ( 2 testcol VARCHAR2(30)); Table created. -- exit SQL*Plus SCOTT@orcl >exit; [oracle@gamma2 ~]$Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 Production With the Partitioning Option, Real Application Clusters, OLAP and Data Mining options -- verify location is Oracle's home directory [oracle@gamma2 ~]$ pwd /home/oracle
-- create a file named "morgan" [oracle@gamma2 ~]$ touch morgan -- look at the file's permissions [oracle@gamma2 ~]$ ls -al morgan -rw-r--r-- 1 oracle oinstall 0 Nov 20 15:56 morgan -- make it executable [oracle@gamma2 ~]$ chmod 755 morgan -- verify it is executable [oracle@gamma2 ~]$ ls -al morgan -rwxr-xr-x 1 oracle oinstall 0 Nov 20 15:56 morgan -- open the file using vi [oracle@gamma2 ~]$ vi morgan -- insert the following w/o quotes: "touch cline" -- verify the file's contents [oracle@gamma2 ~]$ more morgan touch cline -- execute it [oracle@gamma2 ~]$ ./morgan -- verify the cline file was created [oracle@gamma2 ~]$ ls -al cline -rw-r--r-- 1 oracle oinstall 0 Nov 20 16:04 cline -- delete the "cline" file [oracle@gamma2 ~]$ rm cline -- open morgan with vi, remove the TOUCH command -- and put in what you see after "more morgan" below [oracle@gamma2 ~]$ vi morgan [oracle@gamma2 ~]$ more morgan sqlplus scott/tiger@orcl <<EOF INSERT INTO test (testcol) VALUES ('Cline'); COMMIT; EXIT EOF -- execute it ... everything else is what scrolls on screen [oracle@gamma2 ~]$ ./morgan
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 20 17:20:16 2006 Copyright (c) 1982, 2005, Oracle. reserved. All rights
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, Real Application Clusters, OLAP and Data Mining options SCOTT@orcl > 1 row created. SCOTT@orcl > Commit complete. SCOTT@orcl > exit; Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, Real Application Clusters, OLAP and Data Mining options [oracle@gamma2 ~]$ Rescue boot: linux rescue
In the event of failure boot from the Linux CD or DVD
echo $DISPLAY
.bash_profile
hosts.equiv
your cluster below. alpha1 oracle alpha2 oracle #beta1 oracle #beta2 oracle #gamma1 oracle #gamma2 oracle delta1 oracle delta2 oracle alpha-node1 oracle alpha-node2 oracle #beta-node1 oracle #beta-node2 oracle #gamma-node1 oracle #gamma-node2 oracle #delta-node1 oracle #delta-node2 oracle # DO NOT Comment out this entry! topdog oracle