SlideShare a Scribd company logo
Getting Started
UNIX commands are used while connected
directly to bama through an SSH or terminal
interface. Our recommended programs include
SSH Security Shell, TeraTerm with SSH, and
Macintosh Terminal. More information is
available online at ncs.ua.edu.
Commands are entered by giving the command
name, any desired options, then any filenames or
directory names all separated by spaces. When
“enter” is pressed, the command is processed by
bama.
UNIX is case sensitive. All UNIX commands are
lower-case. Type commands demonstrated on
this reference card exactly as shown. File and
directory names can be mixed-case but always
must be typed exactly as named.
For complete lists of options use the “man”
command.
Directories
mkdir directory-name make a new directory
rmdir directory-name remove a directory (must
be empty of all files)
cd directory-name change to a directory
cd change to your home directory
cd .. change to directory one level up
~ home directory
. current directory
.. directory one level back
/ entire filesystem root
Working With Files
ls options filename list files in a directory
Options for ls include:
-a show all files including hidden ones
(those beginning with a “.”)
-l long list showing ownership, permission
and links
-t time-ordered list
-F mark directories with “/”, links with “@”
and executables with “*”
mv options filename new-filename rename a file
mv options filename directory-name
move file to a new directory
mv options directory-name new-directory-name
move a directory and all of its contents to a
new directory, keeping the structure intact.
New directory must already exist.
cp options filename new-filename copy file
rm options filename delete file
The most useful option for mv, cp, and rm is -i.
This will cause command to verify (inquire)
before execution.
Viewing File Contents
page filename go through file one page at a time
less filename page through file with capability
to go backwards
head options filename view the first few lines
tail options filename view the last few lines
Other Useful Commands
clear clear the screen
pine text-based email program
date current date and time
script keep a record of terminal session
quota -v show disk space usage and quota
cat file1 >> file2 append file1 to file2.
ispell options filename spell-check
grep string filename search for string in filename
wc options filename count lines, words, and
characters
filep options filename print a file w/ formatting
Printing
To select a new printer:
LPDEST printername
export LPDEST
lp option filename print file
cancel printjob cancel print job in queue. Get
printjob name from lp command result
enscript options filename format file for
PostScript printer
lpstat –p printername check printer queue. Use
printername “all” to see full list.
Unix Reference Card
Shell Commands
history show previously-run commands
escape (repeat k or j) move up or down
through history of commands. Press “enter”
to re-execute (ksh only).
alias newcommand command-string create new
command that runs command-string, including
all of the given options
command > outputfile command ’s output replaces
outputfile (>> will append)
command < inputfile command ’s input comes
from inputfile
command1 | command2 command1’s output
becomes command2 ’s input
Editing
vi options filename standard (vi)sual editor
emacs options filename terminal-based editor
pico options filename simple text editor
textedit options filename X-windows editor
Permissions and Security
chmod permission filename(s) set level of access.
permissions pertain to (u)ser, (g)roup and
(o)ther and include (r)ead, (w)rite, and
e(x)ecute.
Turn access on with “+”
Turn access off with “-”
Set access exactly to with “=“
chmod go-rwx filename(s) protect your files
from prying eyes
Working With Processes
ps option show running jobs on system.
ps -fu userid show jobs running as userid
kill pid kill job given by process id pid.
Use ps -fu userid to find the pid.
control-z stop the foreground job
bg (fg) put a stopped job into the
background (foreground)
jobs show user’s running and
suspended jobs
nohup command & run command in the
background; it will not stop when you logout.
(applies to ksh only)
X-Windows
. enableX sets user DISPLAY.
Xwindows server must be enabled on PC
netscape start Netscape Navigator
textedit filename edit filename
jws Java Workshop programming suite
ws Sun Workshop programming and
debugging suite
Compressing and Archiving
compress (uncompress) options filename(s)
compress (uncompress) using LZ algorithm.
gzip (gunzip) options filename(s)
slightly more efficient compress/uncompress
zip (unzip) options filename(s) compress
(uncompress) and archive (unarchive)
tar options -f archive-name filename(s)
work with “tar” archive of files:
tar -cvf archive files(s) create archive
tar -xvf archive extract files
tar -tvf archive list files
Scripting
Programs can be be scripted using the any of the
following. Login startup files are in ( ).
/bin/ksh (.profile, .kshrc [if setup])
/bin/sh (.profile)
/usr/local/bin/bash (.bash_login, .bash_profile,
.profile)
/bin/csh (.login, .chsrc)
/usr/local/bin/tcsh (.login, .chsrc)
/usr/local/bin/perl
/usr/local/bin/wish8.0
/usr/local/bin/rexx
Compilers
f77 options filename.f FORTRAN77 (Sun)
f90 options filename.f90 FORTRAN90 (Sun)
cc options filename.c C (Sun)
CC options filename.cc C++ (Sun)
gcc options filename.c C (gnu)
g++ options filename.cc C++ (gnu)
pc options filename.p Pascal (Sun)
Options are compiler-specific. Execute the
compiled binary with ./binary-name
If not specified, binary will be called “a.out”

More Related Content

Similar to unix_ref_card.pdf (20)

PPTX
OS-Module 2 Linux Programming Important topics
JithinS34
 
PDF
Kali linux commands
Jubair Ahmed Junjun
 
PDF
Kali Linux Commands PDF-converted.pdf
Casa Vista Properties
 
TXT
Applecmdlista zs
Ben Pope
 
PDF
Linux file commands and shell scripts
PrashantTechment
 
TXT
An a z index of the bash commands
Ben Pope
 
ODP
Prabu linux
Prabu Cse
 
ODP
Prabu linux
Prabu Cse
 
PDF
KALI-LINUX-COMMANDS.pdf.................
salmannawaz6566504
 
DOCX
50 Most Frequently Used UNIX Linux Commands -hmftj
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PDF
Information about linux operating system
PriyankaMate4
 
PDF
Information about linux operating system
PriyankaMate4
 
DOCX
50 most frequently used unix
Teja Bheemanapally
 
DOCX
50 most frequently used unix
Teja Bheemanapally
 
PDF
basic-unix.pdf
OmprakashNath2
 
ODP
Babitha.linux
banubabitha
 
ODP
Babitha.linux
banubabitha
 
ODP
Babitha.linux
banubabitha
 
ODP
Babitha.linux
banubabitha
 
ODP
Babitha.linux
banubabitha
 
OS-Module 2 Linux Programming Important topics
JithinS34
 
Kali linux commands
Jubair Ahmed Junjun
 
Kali Linux Commands PDF-converted.pdf
Casa Vista Properties
 
Applecmdlista zs
Ben Pope
 
Linux file commands and shell scripts
PrashantTechment
 
An a z index of the bash commands
Ben Pope
 
Prabu linux
Prabu Cse
 
Prabu linux
Prabu Cse
 
KALI-LINUX-COMMANDS.pdf.................
salmannawaz6566504
 
50 Most Frequently Used UNIX Linux Commands -hmftj
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Information about linux operating system
PriyankaMate4
 
Information about linux operating system
PriyankaMate4
 
50 most frequently used unix
Teja Bheemanapally
 
50 most frequently used unix
Teja Bheemanapally
 
basic-unix.pdf
OmprakashNath2
 
Babitha.linux
banubabitha
 
Babitha.linux
banubabitha
 
Babitha.linux
banubabitha
 
Babitha.linux
banubabitha
 
Babitha.linux
banubabitha
 

Recently uploaded (20)

PPTX
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
PPT
introduction to networking with basics coverage
RamananMuthukrishnan
 
PPTX
英国学位证(RCM毕业证书)皇家音乐学院毕业证书如何办理
Taqyea
 
PDF
How to Fix Error Code 16 in Adobe Photoshop A Step-by-Step Guide.pdf
Becky Lean
 
PDF
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
PPTX
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
PPTX
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
PPTX
unit 2_2 copy right fdrgfdgfai and sm.pptx
nepmithibai2024
 
PDF
DevOps Design for different deployment options
henrymails
 
PPTX
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
PPTX
Random Presentation By Fuhran Khalil uio
maniieiish
 
PPT
Computer Securityyyyyyyy - Chapter 2.ppt
SolomonSB
 
PPTX
Research Design - Report on seminar in thesis writing. PPTX
arvielobos1
 
PDF
Apple_Environmental_Progress_Report_2025.pdf
yiukwong
 
PPTX
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
PPTX
Template Timeplan & Roadmap Product.pptx
ImeldaYulistya
 
PDF
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
PPTX
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
PPTX
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
PDF
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
introduction to networking with basics coverage
RamananMuthukrishnan
 
英国学位证(RCM毕业证书)皇家音乐学院毕业证书如何办理
Taqyea
 
How to Fix Error Code 16 in Adobe Photoshop A Step-by-Step Guide.pdf
Becky Lean
 
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
unit 2_2 copy right fdrgfdgfai and sm.pptx
nepmithibai2024
 
DevOps Design for different deployment options
henrymails
 
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
Random Presentation By Fuhran Khalil uio
maniieiish
 
Computer Securityyyyyyyy - Chapter 2.ppt
SolomonSB
 
Research Design - Report on seminar in thesis writing. PPTX
arvielobos1
 
Apple_Environmental_Progress_Report_2025.pdf
yiukwong
 
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
Template Timeplan & Roadmap Product.pptx
ImeldaYulistya
 
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
Ad

unix_ref_card.pdf

  • 1. Getting Started UNIX commands are used while connected directly to bama through an SSH or terminal interface. Our recommended programs include SSH Security Shell, TeraTerm with SSH, and Macintosh Terminal. More information is available online at ncs.ua.edu. Commands are entered by giving the command name, any desired options, then any filenames or directory names all separated by spaces. When “enter” is pressed, the command is processed by bama. UNIX is case sensitive. All UNIX commands are lower-case. Type commands demonstrated on this reference card exactly as shown. File and directory names can be mixed-case but always must be typed exactly as named. For complete lists of options use the “man” command. Directories mkdir directory-name make a new directory rmdir directory-name remove a directory (must be empty of all files) cd directory-name change to a directory cd change to your home directory cd .. change to directory one level up ~ home directory . current directory .. directory one level back / entire filesystem root Working With Files ls options filename list files in a directory Options for ls include: -a show all files including hidden ones (those beginning with a “.”) -l long list showing ownership, permission and links -t time-ordered list -F mark directories with “/”, links with “@” and executables with “*” mv options filename new-filename rename a file mv options filename directory-name move file to a new directory mv options directory-name new-directory-name move a directory and all of its contents to a new directory, keeping the structure intact. New directory must already exist. cp options filename new-filename copy file rm options filename delete file The most useful option for mv, cp, and rm is -i. This will cause command to verify (inquire) before execution. Viewing File Contents page filename go through file one page at a time less filename page through file with capability to go backwards head options filename view the first few lines tail options filename view the last few lines Other Useful Commands clear clear the screen pine text-based email program date current date and time script keep a record of terminal session quota -v show disk space usage and quota cat file1 >> file2 append file1 to file2. ispell options filename spell-check grep string filename search for string in filename wc options filename count lines, words, and characters filep options filename print a file w/ formatting Printing To select a new printer: LPDEST printername export LPDEST lp option filename print file cancel printjob cancel print job in queue. Get printjob name from lp command result enscript options filename format file for PostScript printer lpstat –p printername check printer queue. Use printername “all” to see full list. Unix Reference Card
  • 2. Shell Commands history show previously-run commands escape (repeat k or j) move up or down through history of commands. Press “enter” to re-execute (ksh only). alias newcommand command-string create new command that runs command-string, including all of the given options command > outputfile command ’s output replaces outputfile (>> will append) command < inputfile command ’s input comes from inputfile command1 | command2 command1’s output becomes command2 ’s input Editing vi options filename standard (vi)sual editor emacs options filename terminal-based editor pico options filename simple text editor textedit options filename X-windows editor Permissions and Security chmod permission filename(s) set level of access. permissions pertain to (u)ser, (g)roup and (o)ther and include (r)ead, (w)rite, and e(x)ecute. Turn access on with “+” Turn access off with “-” Set access exactly to with “=“ chmod go-rwx filename(s) protect your files from prying eyes Working With Processes ps option show running jobs on system. ps -fu userid show jobs running as userid kill pid kill job given by process id pid. Use ps -fu userid to find the pid. control-z stop the foreground job bg (fg) put a stopped job into the background (foreground) jobs show user’s running and suspended jobs nohup command & run command in the background; it will not stop when you logout. (applies to ksh only) X-Windows . enableX sets user DISPLAY. Xwindows server must be enabled on PC netscape start Netscape Navigator textedit filename edit filename jws Java Workshop programming suite ws Sun Workshop programming and debugging suite Compressing and Archiving compress (uncompress) options filename(s) compress (uncompress) using LZ algorithm. gzip (gunzip) options filename(s) slightly more efficient compress/uncompress zip (unzip) options filename(s) compress (uncompress) and archive (unarchive) tar options -f archive-name filename(s) work with “tar” archive of files: tar -cvf archive files(s) create archive tar -xvf archive extract files tar -tvf archive list files Scripting Programs can be be scripted using the any of the following. Login startup files are in ( ). /bin/ksh (.profile, .kshrc [if setup]) /bin/sh (.profile) /usr/local/bin/bash (.bash_login, .bash_profile, .profile) /bin/csh (.login, .chsrc) /usr/local/bin/tcsh (.login, .chsrc) /usr/local/bin/perl /usr/local/bin/wish8.0 /usr/local/bin/rexx Compilers f77 options filename.f FORTRAN77 (Sun) f90 options filename.f90 FORTRAN90 (Sun) cc options filename.c C (Sun) CC options filename.cc C++ (Sun) gcc options filename.c C (gnu) g++ options filename.cc C++ (gnu) pc options filename.p Pascal (Sun) Options are compiler-specific. Execute the compiled binary with ./binary-name If not specified, binary will be called “a.out”