file=linux_commands.htm; updated 5/8/2008

HELPFUL LINUX COMMANDS

 

man <keyword>

help screen for <keyword>
example:  man ps
  will display help about the ps command

env

display environment variables

mkdir <directory>

make <directory>
example:  mkdir archives
  will create a subdirectory named archives.

cp f1 f2

copy file f1 to file f2
example:  cp init.ora  /a01/student/user100/initUSER100.ora
  will copy the file named init.ora from the current subdirectory to the
  subdirectory and filename initUSER100.ora given in the command.

mv f1 f2 

move file f1 to file f2
example:  mv init.ora  /a01/student/user100/initUSER100.ora
  will move the file named init.ora from the current subdirectory to the  subdirectory and filename initUSER100.ora given in the command.

rm <filename>

remove <file> (like deleting)
example:  rm junkfile.lst
  will delete the file named junkfile.lst on the current subdirectory.

cat <file>

type contents of <file> to the screen for display
example:  cat login.sql
  will display the contents of the file named login.sql.

more <file>

type contents of <file>; pause at pages
example:  more login.sql
  will display the contents of the file named login.sql and will pause the display each time the screen fills with data.

pg <file>

same as more but on at&t unix (sys v)

ps -ef 

will display all processes running on the server
example:  ps -ef

ps  -ef | grep oracle

will display processes running on the server that are associated with a specific system user.  Note the use of the | "pipe" symbol.
example:  ps -ef | grep oracle
  will display all processes running that are associated with with the user or software named oracle

ps  -ef | more

will display all processes running (yours and those belonging to other users) and will pause the display each time the screen fills with data.
extended example:  ps - ef | grep oracle | more
  will display all processes associated with oracle and will pause the screen each time it fills with data.

kill -9 PID
killl -9 1359

command used to terminate a process (identified by the process id - PID), here the process number is 1359.  The process number is determined by using the ps -ef command to display processes that are running (look under the PID column of data that is displayed by the ps -ef command.

chmod 777 *

sets access rights to every file or subdirectory in a directory.
examplechmod 777 systemUSER150.dbf
  will set the permission levels to read/write/execute for the owner (first digit), group (second digit), and world (3rd digit) for the file named systemUSER150.dbf
another example:  chmod 750 systemUSER150.dbf
  will set the permission levels to r/w/e for the owner, r/w/- for the group and -/-/- for the world.

you select the appropriate code for read/write/execute combinations.

ls -l

lists files & security status, but does not list hidden files.

ls -a

shows hidden files.

ls -al

lists files and security status for all files.

pwd

print working directory.  prints the disk drive and subdirectory of the current working directory.

cd .. 

(cd space dot dot) changes directory; here the dot dot entry will backup to a higher point in a directory tree.

cd /u01/newhome

change to the /u01/newhome disk drive and directory. 

cd $home

change directory to your home directory as defined in your .profile file.

TERM=vt100;export TERM
 

will change the terminal emulation to the vt100 emulation and the export TERM command will reset the value of the TERM environment variable.  Note that the command is case-sensitive.

ORACLE_SID=user150
export ORACLE_SID

will change the value of the ORACLE_SID to user150, and the export ORACLE_SID will reset the value of this environment variable.