Wednesday, August 6, 2008

Unix / Linux commands

Oracle Certification Program Candidate Guide


Unix command

Description

Details


ALIAS

Create abbreviations (aliases) for commands

alias abbreviation=command
Displays a list of all aliases, standard arguments can be used (-a, -l, etc.). To cancel the alias use the unalias command. F.e. alias my_command='ls -al'.


ARCHIE

Change the current directory

archie filename
Search the Archie database for a file on a FTP site.


AT

Execute a command at a specified time

at [-filename][-m] time
-filename
- Read the command(s) from the file specified.
-m = Notify the user by mail when the job is completed.
time = The time when the commands are going to be executed.


BC

Use the calculator

bc
To use decimals, type scale = number (of decimal digits). End the calculator with Ctrl-D.


BG

Execute processes in the background

bg [%n]
%n =
Without this parameter it displays the jobs that are currently executed in the background. With a number the process with the given number is executed in the background.
& = At the end of a command starts the process in the background.


CAL

Display the calendar of the current month

cal [month][year]


CANCEL

Cancel requests for printing

cancel [ -u user] print-request
Requests can be cancelled by using the printer-id or by specifying the printer name.
-u user = Cancel print jobs that are queued for the specified user.


CAT

Display one or more files

cat [-sn] [filenames]
If more than one filename is supplied, it is added at the end of the previous file and displayed.
-n = Display numbers in ascending order in front of each line.
-s = Do not comment about nonexistent files.
filenames = The filename(s) in the order that you want them to be displayed.


CD

Change the current directory

cd [pathname]
Change the current directory to pathname or to root directory if no pathname is given.


CHGRP

Change group name

chgrp groupname filename(s) | directory name(s)
Change group of the named file or directory.


CHMOD

Set file access permissions

chmod [ugo,+-,rwx] filename | directory name
Change mode permissions of the named file(s) or directory(ies).
See File permissions for detailed information.


CHOWN

Change owner

chown username filename | directoryname
Change the owner of a file or directory.


CHSH

Change shell

chsh
Change the Unix shell you log into.


CLEAR

Clears display

clear
Clears the display. Only the prompt is displayed.


CMP

Compare files

cmp filename filename
Compares the named files. If they are equal nothing is returned, otherwise it returns the first character and line where the two files differ.


COMPRESS

Compress file

compress [-v] filename
Compress the named file. The compressed file gets .Z appended to the filename.
-v = Ask for verification after compressing the file.


CP

Copy a file

cp oldname newname [-r][-i] pathname (cp index.html index1.html)
The
cp command allows you to copy files to new files, or copy files and directories to new directories. The command line cp index.html otherdir will copy the file index.html to the directory otherdir.
-i = Ask before updating a file or directory that exists in the destination with the same name.
-r = To copy a directory including its contents to a new directory, recursive.


CRONTAB

Scheduled files

crontab filename [-r][-l][-e] pathname
The
crontab command allows you to run, delete or edit scheduled tasks.
-l = lists your currently scheduled tasks.
-r = deletes all currently scheduled tasks.
-e = edit your scheduled tasks.


DATE

List current date and time

date


DF

Disk space info

df [-k] [filesystem]
Shows disk space available on the system.
-k = Use 1024 byte blocks instead of the default 512.
filesystem = If omitted displays the amount of disk space used and available on all mounted filesystems.


DU

Disk space info

du [-aks] [filename | directoryname]
Shows how much disk space is being used up by folders.
-a = Shows counts for all files encountered, not only directories.
-k = Use 1024 byte blocks instead of the default 512.
-s = Don't display space usage of subdirectories.


DIFF

Display the differences between two text files

diff textfile1 textfile2


ECHO

Output string

echo characterstring
Displays the character string to the standard output device.


EXIT

Exit system

exit
Exit the system or logout.


FG

Execute processes in the foreground

fg [%n]
%n =
Without this parameter it restarts the job that is currently executed in the background. With a number the process with the given number is restarted in the foreground.
& = At the end of a command starts the process in the foreground.


FILE

File classification

file filename(s)
Shows information about the file type of the filename(s).


FIND

Search command

find directorypath(s) searchpattern action(s)
Search the specified directorie(s) for files that satisfy the search pattern and act on them according to the action(s) parameter.
Search-patterns
-name filename = search for files with the specified filename.
- size n = search for files of n blocks (usually 512 or 1024 bytes).
- links n = search for files with n links.
- atime n = search for files that have been last accessed before n days.
- mtime n = search for files that have been last modified before n days.
- newer filename = search for files that have been modified more recently than the specified file.
Actions
- print = display the path(s) of the files found.
- exec command = run command for each file found
- ok command = as exec, but it asks for approval before the action.
Notes
Search patterns can be combined.
! = negation
-o = logical OR
One or more search patterns are combined using logical AND.
( ) or \ \ = these can be used to define groups of search patterns.


FINGER

User info

finger emailaddress
Shows more information about a user.


FTP

FTP to a site

ftp hostname (or IP address)
Connects to a FTP site.


GCC

Compile source code

gcc option filename
Compile source code into a file.


GOPHER

Connect to Gopher

gopher
Use the Gopher database browser.


GREP

Search in a file

grep [-c,-n,-i,-v,-w,-y] pattern [filename(s)]
Search for a string in a file or files.
-c = displays only the number of lines that match.
-n = displays the line number in front of every displayed line.
-i = ignore case.
-v = displays all other lines except those lines that match.
-w = matches whole words only.
-y = case independent pattern matching, lower case letters in pattern will also match upper case letters in the input.


GZIP

Compress a file

gzip filename
Compress a file.


HEAD

Display head of a file

head [-n] filename(s)
Display the first
n lines of the named file(s). If no number is given the first 10 lines are displayed.
-n = the number of lines to display from the top of the file.


HOSTNAME

Display hostname

hostname
Display the name of the host machine.


IRC

Connect to IRC

irc hostname (or IP address)
Connect to an Internet Relay Chat host.


JOBS

Display active processes

jobs


KILL

Terminate process

kill [-signr] process_ID
Terminate the process with the specified process ID.
-9 = send a definite kill signal.


LOGOUT

Logs off the system

logout


lprint Print a file lprintd Abort a print job lprintq List the print queue


LS

List files in the current directory

ls [-CFRR*acdglrstu] [list of filenames or directories]
The -
a switch will include hidden files (hidden files in UNIX begin with a dot (.)), the current directory and parent directory entries (. and .. respectively). You can combine switches by placing them one after the other (ls -la, etc..)
-C = list entries in columns.
-F = list directories with /.
-R = list subdirectories as well.
-R* = list subdirectories 2 levels below current directory.
-a = list all entries, including files with a dot (.htaccess, etc..).
-c = sort entries by last modified date.
-d = list directories only.
-g = list hidden files and directories.
-l = list in long format (mode, no of links, owner, group, size, and modified date).
-r = list in reverse order.
-s = list size in 1024 byte blocks.
-t = sort contents by time of last modified date.
-u = use time of last access (not last modified date) for sorting (with -t) or printing onscreen (with -l).


MAKE

Compile source code

make command
Compile a source code.


MAKEFILE

Compile source code file

make filename
Compile a source code into a file.


MAN

Read the help

man command
Shows the help on the entered command, f.e.
man ls, man chmod, etc.
To search for some text, press the forward-slash (/) key and type the text you want to search for. If you want to run a program that's in your current directory, you'll need to put a dot-slash (./) in front of the program name.


MKDIR

Create a directory

mkdir directoryname, mkdir -i directoryname
To create a directory in the current directory, type
mkdir followed by the directory name. To delete a directory and all its contents, use rm -r directoryname. The -i parameter will make the system prompt you before deleting a file or directory. If the directory is empty, you can also delete it using the rmdir command.


MORE

List a file

more filename
View a file with a pause after every full screen.


MV

Rename a file

mv oldname newname


PASSWORD

Change password

password
Change the administrator password.


PICO

Edit a file

pico filename
An easy to use text editor.


PINE

A mailer program

pine
An easy to use mailer program.


PWD

What is the current directory

pwd


RM

Delete/remove a file

rm filename
To delete a single file, use rm filename.


RMDIR

Remove a directory

rmdir directoryname, rm -r directoryname ( to delete folders with its files).


RZ

Receive a file

rz
Receive a file using Zmodem.


SZ

Send a file

sz filename
Send a file using Zmodem.


TAIL

Show last lines of a file

tail filename
Show the last few lines of a file.


TALK

Page user to chat

talk username
Pages the user for a chat, the user is an e-mail address.


TAR

Archive files

tar filename
Create or extract multiple file archives. Other methods are lharc, lzh, and lha, but these methods may not be present on your system.


TIN, TRN

Connect to Usenet

tin, trn
Connect to Usenet newsgroups.


TELNET

Connect

telnet hostname (or IP address)
Connect to an Internet web site.


DOS2UNIX

Conversion of text files

dos2unix filename newname
Strips the carriage returns (CR) from the DOS text file.

UNIX2DOS

Conversion of text files

unix2dos filename newname
Adds the carriage returns (CR) to the Unix text file.


WHO

Who is logged in?

who
Shows who is logged into the local system.

W

Who is logged in and what are they doing?

w
Shows who is logged into the local system and what they are doing.


WRITE

Write to a user

write username
Write to a user on the local system (CTRL-C to end it).


ZIP

Compress to zip

zip username
Compress to zip for IBM files.

No comments:

Search

My Blog List