Вы находитесь на странице: 1из 2

Unix Dictionary

Wednesday, April 03, 2013 1:33 PM

Following is a very brief introduction to some useful Unix commands, including examples of how to use each command.

Unix commands are mnemonic & case-sensitive


Unix commands typically have this syntax: command option(s) argument(s)

Command / File Meaning Syntax Example(s)


./ Execute a shell script in the current directory from the ./{your-script-name} ./MPUSBANKCC.prog
command line
./path/to/your-script-name
You must be in the same directory as your script, or if
you are not in the directory, add the path

Depending on shell and directory, can also use


your-script-name
bash your-script-name
sh your-script-name
. your-script-name
> Redirect output (to file, another command) command > filename date > output.txt

Note: will overwrite existing file cat test1 test2 > test3
>> Append output command > filename echo "This is the next line of the log" >> log.file

Will preserve whatever is in the log and add the text as the last line.
< Redirect an input-file command filename < filename

Note: will overwrite existing file


.ctl Control file
.pls stands for plsql files. In apps patch these files contain
code to create package spec or package body or both.
cd change directory Command directory cd {space} new_directory

cd /orastage/tmp
chmod Change file permissions Command permission filename To make a file executable:
chmod +x interface.prog

To open up all permissions"


chmod 777 interface.prog

To change all permission in a subfolder:


chmod -R 777 bin
cp Copy file (within same folder unless you specify a cd {space} old_filename {space} new_filename Copy file within same folder while changing name of target file:
path) cp gl_20170515a.txt.arc gl_20170515b.txt

Copy file to a subfolder:


cp STREAMSPONSOR.txt misc/
Esc :q! quit (escape) editor without saving changes
env Display environment variables, see also set and Command Create a file that contains the environment variables:
printenv env > mp_env
Find Find a file with a certain name pattern The general form of the command is: find /etc/ -name 'printers.conf'

find (starting directory) (matching criteria and This tries to find a file named printers.conf, in a directory called etc and
The find command will begin looking in the starting actions) when found, will display the path.
directory you specify and proceed to search through
all accessible subdirectories. You may specify more
than one starting directory for searching.

grep A utility for searching data for lines that match a given Command option filename Search for string linux in the index.html file:
pattern. Its name comes from globally search a grep linux index.html
regular expression and print.
Insensitive case search:
grep -i linux index.html

Searching for a string in multiple files:


grep linux file*.*
info Read the Info pages about a command, somewhat info {command} Info info
easier to use than man
ln Symbolic link. Also termed a soft link, is a special kind ln -s source_file symbolic_link ln -s STREAMJOB.prog STREAMJOB
of file that points to another file, much like a shortcut
in Windows or a Macintosh alias. Unlike a hard link, a
symbolic link does not contain the data in the target
file. It simply points to another entry somewhere in
the file system.
lo Logout. Closes your shell access. lo
logout
ls List files in the current directory ls corp*

MP Tickets Page 1
ls List files in the current directory ls corp*

Returns any files starting with "corp"


ls -ltr List contents of a directory w attributes; 1 line for Command option ls -ltr
each item; sorted most recent; sorted by file name in
reverse alphabetical order
ls Lists the file attributes Command option ls -l MP*
Lists the file attributes for all files starting with "MP"

ls -ld sql
Returns attributes for the directory "sql"
ps report process status
pwd The present working directory
vi enter Vi editor
man Online manual that explains a command man {command} man mkdir

Will show all the documentation for the mkdir command


mkdir Make a directory mkdir {folder name} mkdir streamlyne
mv Move a file. Used to rename and move files and mv [options] old-file-name new-file-name Move one file in current directory into a subdirectory:
directories. mv chk_file5.prog misc

Move all files in current directory into a subdirectory call budget:


mv * budget

Rename:
mv stream_move_03.ksh STREAMJOB.prog
Rmdir Remove a directory. Directory must be empty. {command} {option} {directory name} To remove a directory called wf, enter:
rmdir wf
Shell script Shells accept commands from you via the keyboard
and execute them. These commands stored in a text
file is a shell script.
Sleep Delays for specified amount of time (seconds is the sleep NUMBER[SUFFIX] To sleep for 5 seconds, use:
default) before continuing to the next command. sleep 5
s for seconds (the default)
m for minutes To sleep for 2 minutes, use:
h for hours sleep 2m
d for days
To sleep for 3 hours, use:
sleep 3h
whatis A short explanation about a command whatis{command} whatis ls
whoami User name
wc Word count. Gives the count of characters, words, Command option filename wc *.pdb
lines. Has conditions that you can use for additional
functionality.
Or for just the number of lines in one specified file
wc -l pentane.pdb

Useful site: Introduction to Unix commands, from <https://kb.iu.edu/d/afsk>

MP Tickets Page 2

Вам также может понравиться