SlideShare uma empresa Scribd logo
1 de 12
Treebeard's Unix Cheat Sheet
People who use Windows without DOS, or a Macintosh, or PPP without a terminal, or an ISP's
menu without the Unix prompt are at a disadvantage. Something is happening, and they don't
know what it is. I like to know what's really going on, so I've been learning some Unix.

The Net is a Unix place. I'm no wizard, but I'm comfortable with basic commands and occasionally
type "rm" at my DOS prompt instead of "del". This is my Unix cheat sheet, so I can remember.
Uppercase and lowercase matter. These commands (mostly) work with my C-shell account on
RAIN. Your account might be different, especially if your prompt ends with a "$" (Korn shell)
rather than a "%", so be cautious. When I need help, I reach for the books UNIX in a Nutshell
(O'Reilly) and Unix Unbound by Harley Hahn (Osborne/McGraw Hill, 1994).

This page won't look right without table support. Most of this is available in a text version.


Help on any Unix command. RTFM! Help on any Unix command.
RTFM! Help on any Unix command. RTFM!
       man {command}     Type man ls to read the manual for the ls command.
       man {command} >
                         Redirect help to a file to download.
       {filename}
       whatis {command} Give short description of command. (Not on RAIN?)
                         Search for all Unix commands that match keyword, eg apropos
       apropos {keyword}
                         file. (Not on RAIN?)

List a directory List a directory List a directory
                             It's ok to combine attributes, eg ls -laF gets a long listing of all
       ls {path}
                             files with types.
       ls {path_1}
                             List both {path_1} and {path_2}.
       {path_2}
       ls -l {path}          Long listing, with date, size and permisions.
                             Show all files, including important .dot files that don't otherwise
       ls -a {path}
                             show.
       ls -F {path}          Show type of each file. "/" = directory, "*" = executable.
       ls -R {path}          Recursive listing, with all subdirs.
       ls {path} >
                             Redirect directory to a file.
       {filename}
       ls {path} | more      Show listing one screen at a time.
       dir {path}            Useful alias for DOS people, or use with ncftp.

Change to directory Change to directory Change to directory
       cd {dirname}          There must be a space between.
       cd ~                  Go back to home directory, useful if you're lost.
       cd ..                 Go back one directory.
       cdup                  Useful alias, like "cd ..", or use with ncftp.

Make a new directory Make a new directory Make a new directory
       mkdir {dirname}

Remove a directory Remove a directory Remove a directory
       rmdir {dirname}       Only works if {dirname} is empty.
rm -r {dirname}        Remove all files and subdirs. Careful!

Print working directory Print working directory Print working
directory
                             Show where you are as full path. Useful if you're lost or
      pwd
                             exploring.

Copy a file or directory Copy a file or directory Copy a file or
directory
      cp {file1} {file2}
      cp -r {dir1} {dir2}    Recursive, copy directory and all subdirs.
      cat {newfile} >>
                             Append newfile to end of oldfile.
      {oldfile}

Move (or rename) a file Move (or rename) a file Move (or rename) a
file
      mv {oldfile}
                             Moving a file and renaming it are the same thing.
      {newfile}
      mv {oldname}
      {newname}

Delete a file Delete a file Delete a file
                             ? and * wildcards work like DOS should. "?" is any character;
      rm {filespec}
                             "*" is any string of characters.
                             Good strategy: first list a group to make sure it's what's you
      ls {filespec}
                             think...
      rm {filespec}
                             ...then delete it all at once.

Download with
                             Download with zmodem (Use sx with xmodem.)
zmodem
                             -a = ascii, -b = binary. Use binary for everything. (It's the
      sz [-a|b] {filename}
                             default?)
                             Handy after downloading with FTP. Go talk to your spouse while
      sz *.zip
                             it does it's stuff.

Upload with zmodem Upload with zmodem (Use rx with xmodem.)
                             Give rz command in Unix, THEN start upload at home. Works
      rz [-a|b] (filename}
                             fine with multiple files.

View a text file View a text file View a text file
      more {filename}        View file one screen at a time.
      less {filename}        Like more, with extra features.
      cat {filename}         View file, but it scrolls.
      cat {filename} |
                             View file one screen at a time.
      more
      page {filename}        Very handy with ncftp.
      pico {filename}        Use text editor and don't save.

Edit a text file. Edit a text file. Edit a text file.
                             The same editor PINE uses, so you already know it. vi and
      pico {filename}
                             emacs are also available.
Create a text file. Create a text file. Create a text file.
                              Enter your text (multiple lines with enter are ok) and press
      cat > {filename}
                              control-d to save.
      pico {filename}         Create some text and save it.

Compare two files Compare two files Compare two files
      diff {file1} {file2}    Show the differences.
      sdiff {file1} {file2}   Show files side by side.

Other text commands Other text commands Other text commands
      grep '{pattern}'
                              Find regular expression in file.
      {file}
      sort {file1} >
                              Sort file1 and save as file2.
      {file2}
      sort -o {file} {file}   Replace file with sorted version.
      spell {file}            Display misspelled words.
      wc {file}               Count words in file.

Find files on system Find files on system Find files on system
      find {filespec}         Works with wildcards. Handy for snooping.
      find {filespec} >
                              Redirect find list to file. Can be big!
      {filename}

Make an Alias Make an Alias Make an Alias
      alias {name}            Put the command in 'single quotes'. More useful in your .cshrc
      '{command}'             file.

Wildcards and Shortcuts Wildcards and Shortcuts Wildcards and
Shortcuts
                              Match any string of characters, eg page* gets page1, page10,
      *
                              and page.txt.
                              Match any single character, eg page? gets page1 and page2,
      ?
                              but not page10.
                              Match any characters in a range, eg page[1-3] gets page1,
      [...]
                              page2, and page3.
                              Short for your home directory, eg cd ~ will take you home, and
      ~
                              rm -r ~ will destroy it.
      .                       The current directory.
      ..                      One directory up the tree, eg ls ...

Pipes and                     Pipes and Redirection (You pipe a command to another
Redirection                   command, and redirect it to a file.)
      {command} > {file} Redirect output to a file, eg ls > list.txt writes directory to file.
      {command} >>       Append output to an existing file, eg cat update >> archive
      {file}             adds update to end of archive.
      {command} < {file} Get input from a file, eg sort < file.txt
      {command} <        Get input from file1, and write to file2, eg sort < old.txt >
      {file1} > {file2}  new.txt sorts old.txt and saves as new.txt.
      {command} |        Pipe one command to another, eg ls | more gets directory and
      {command}          sends it to more to show it one page at a time.
Permissions, important and tricky! Permissions, important and
tricky! Permissions, important and tricky!
     Unix permissions concern who can read a file or directory, write to it, and execute
     it. Permissions are granted or withheld with a magic 3-digit number. The three digits
     correspond to the owner (you); the group (?); and the world (everyone else).
     Unix permissions concern who can read a file or directory, write to it, and execute
     it. Permissions are granted or withheld with a magic 3-digit number. The three digits
     correspond to the owner (you); the group (?); and the world (everyone else).

     Think of each digit as a sum:
exe
cut
e
per
mis
sion
=1


writ
e
per
mis
sion
=2


writ
e
and
exe
cut
e
(1+
2)
=3


rea
d
per
mis
sion
=4


rea
d
and
exe
cut
e
(4+
1)
=5


rea
d
and
writ
e
(4+
2)
=6
Add the number value of the permissions you want to grant each group to make a
     three digit number, one digit each for the owner, the group, and the world. Here are
     some useful combinations. Try to figure them out! Add the number value of the
     permissions you want to grant each group to make a three digit number, one digit
     each for the owner, the group, and the world. Here are some useful combinations.
     Try to figure them out!




     chmod 600
                          You can read and write; the world can't. Good for files.
     {filespec}
     chmod 700            You can read, write, and execute; the world can't. Good for
     {filespec}           scripts.
     chmod 644            You can read and write; the world can only read. Good for web
     {filespec}           pages.
                          You can read, write, and execute; the world can read and
     chmod 755
                          execute. Good for programs you want to share, and your
     {filespec}
                          public_html directory.

Permissions, another way Permissions, another way Permissions,
another way
     You can also change file permissions with letters: You can also change file
     permissions with letters:


     u=
     use
     r
     (yo
     urs
     elf)
     g=
     gro
     up
     a=
     eve
     ryo
     ne


     r=
     rea
     d
     w
     =
     writ
     e
     x=
     exe
     cut
     e


                                                    chmod u+rw {filespec}
Give yourself read and write permission
chmod u+x {filespec}
Give yourself execute permission.
chmod a+rw {filespec}
Give read and write permission to everyone.
Applications I use
finger {userid}
Find out what someone's up to.
gopher
Gopher.
irc
IRC, but not available on RAIN.
lynx
Text-based Web browser, fast and lean.
ncftp
Better FTP.
pico {filename}
Easy text editor, but limited. vi and emacs are available.
pine
Email.
telnet {host}
Start Telnet session to another host.
tin
Usenet.
uudecode {filename}
uuencode {filename}
Do it on the server to reduce download size about 1/3.
ytalk {userid}
Chat with someone else online, eg ytalk mkummel. Please use w first so you don't
interrupt a big download!
System info
date
Show date and time.
df
Check system disk capacity.
du
Check your disk usage and show bytes in each directory.
more /etc/motd
Read message of the day, "motd" is a useful alias..
printenv
Show all environmental variables (in C-shell% - use set in Korn shell$).
quota -v
Check your total disk use.
uptime
Find out system load.
w
Who's online and what are they doing?
u=
user
(yo
urse
lf)
g=
gro
up
a=
ever
yon
e


r=
read
w=
writ
e
x=
exe
cute


                                                             chmod u+rw {filespec}
Give yourself read and write permission
chmod u+x {filespec}
Give yourself execute permission.
chmod a+rw {filespec}
Give read and write permission to everyone.
Applications I use
finger {userid}
Find out what someone's up to.
gopher
Gopher.
irc
IRC, but not available on RAIN.
lynx
Text-based Web browser, fast and lean.
ncftp
Better FTP.
pico {filename}
Easy text editor, but limited. vi and emacs are available.
pine
Email.
telnet {host}
Start Telnet session to another host.
tin
Usenet.
uudecode {filename}
uuencode {filename}
Do it on the server to reduce download size about 1/3.
ytalk {userid}
Chat with someone else online, eg ytalk mkummel. Please use w first so you don't
     interrupt a big download!
     System info
     date
     Show date and time.
     df
     Check system disk capacity.
     du
     Check your disk usage and show bytes in each directory.
     more /etc/motd
     Read message of the day, "motd" is a useful alias..
     printenv
     Show all environmental variables (in C-shell% - use set in Korn shell$).
     quota -v
     Check your total disk use.
     uptime
     Find out system load.
     w
     Who's online and what are they doing?
     chmod u+rw
                          Give yourself read and write permission
     {filespec}
     chmod u+x
                          Give yourself execute permission.
     {filespec}
     chmod a+rw
                          Give read and write permission to everyone.
     {filespec}

Applications I use Applications I use Applications I use
     finger {userid}      Find out what someone's up to.
     gopher               Gopher.
     irc                  IRC, but not available on RAIN.
     lynx                 Text-based Web browser, fast and lean.
     ncftp                Better FTP.
     pico {filename}      Easy text editor, but limited. vi and emacs are available.
     pine                 Email.
     telnet {host}        Start Telnet session to another host.
     tin                  Usenet.
     uudecode
     {filename}
                          Do it on the server to reduce download size about 1/3.
     uuencode
     {filename}
                          Chat with someone else online, eg ytalk mkummel. Please use
     ytalk {userid}
                          w first so you don't interrupt a big download!

System info System info System info
     date                 Show date and time.
     df                   Check system disk capacity.
     du                   Check your disk usage and show bytes in each directory.
     more /etc/motd       Read message of the day, "motd" is a useful alias..
                          Show all environmental variables (in C-shell% - use set in Korn
     printenv
                          shell$).
     quota -v             Check your total disk use.
     uptime               Find out system load.
w                      Who's online and what are they doing?
Unix Directory Format

 Long listings (ls -l) have this format:


- file d directory, * executable ^ symbolic links (?) file size (bytes) file name /
directory ^ ^ ^ ^ ^ drwxr-xr-x 11 mkummel 2560 Mar 7 23:25 public_html/ -rw-r--r--
1 mkummel 10297 Mar 8 23:42 index.html ^ ^^^ user permission (rwx) date and time
last modified ^^^ group permission (rwx) ^^^ world permission (rwx)


How to Make an Alias

 An alias lets you type something simple and do something complex. It's a shorthand for a
 command. If you want to type "dir" instead of "ls -l" then type alias dir 'ls -l'. The single
 quotes tell Unix that the enclosed text is one command.


Aliases are more useful if they're permanent so you don't have to think about them. You can do
this by adding the alias to your .cshrc file so they're automatically loaded when you start. Type
pico .cshrc and look for the alias section and add what you want. It will be effective when you
start. Just remember that if you make an alias with the name of a Unix command, that command
will become unavailable.

Here are a few aliases from my .cshrc file:

# enter your aliases here in the form: # alias this means this alias h history
alias m more alias q quota -v alias bye exit alias ls ls -F alias dir ls alias cdup
cd .. alias motd more /etc/motd


How to Make a Script

 A Unix script is a text file of commands that can be executed, like a .bat file in DOS. Unix
 contains a powerful programming language with loops and variables that I don't really
 understand. Here's a useful example.


Unix can't rename a bunch of files at once the way DOS can. This is a problem if you develop Web
pages on a DOS machine and then upload them to your Unix Server. You might have a bunch of
.htm files that you want to rename as .html files, but Unix makes you do it one by one. This is
actually not a defect. (It's a feature!) Unix is just being more consistent than DOS. So make a
script!

Make a text file (eg with pico) with the following lines. The first line is special. It tells Unix what
program or shell should execute the script. Other # lines are comments.

#! /bin/csh # htm2html converts *.htm files to *.html foreach f ( *.htm ) set
base=`basename $f .htm` mv $f $base.html end Save this in your home directory as
htm2html (or whatever). Then make it user-executable by typing chmod 700 htm2html. After
this a * will appear by the file name when you ls -F, to show that it's executable. Change to a
directory with .htm files and type ~/htm2html, and it will do its stuff.
Think about scripts whenever you find yourself doing the same tedious thing over and over.


Dotfiles (aka Hidden Files)

 Dotfile names begin with a "." These files and directories don't show up when you list a
 directory unless you use the -a option, so they are also called hidden files. Type ls -la in your
 home directory to see what you have.


Some of these dotfiles are crucial. They initialize your shell and the programs you use, like
autoexec.bat in DOS and .ini files in Windows. rc means "run commands". These are all text
files that can be edited, but change them at your peril. Make backups first!

Here's some of what I get when I type ls -laF:

.addressbook     my email addressbook.
.cshrc           my C-shell startup info, important!
.gopherrc        my gopher setup.
.history         list of past commands.
.login           login init, important!
.lynxrc          my lynx setup for WWW.
.ncftp/          hidden dir of ncftp stuff.
.newsrc          my list of subscribed newsgroups.
.pinerc          my pine setup for email.
.plan            text appears when I'm fingered, ok to edit.
.profile         Korn shell startup info, important!
.project         text appears when I'm fingered, ok to edit.
.signature       my signature file for mail and news, ok to edit.
.tin/            hidden dir of my tin stuff for usenet.
.ytalkrc         my ytalk setup.
DOS and UNIX commands

Action                         DOS                            UNIX
change directory               cd                             cd
change file protection         attrib                         chmod
compare files                  comp                           diff
copy file                      copy                           cp
delete file                    del                            rm
delete directory               rd                             rmdir
directory list                 dir                            ls
edit a file                    edit                           pico
environment                    set                            printenv
find string in file            find                           grep
help                           help                           man
make directory                 md                             mkdir
move file                      move                           mv
rename file                    ren                            mv
show date and time             date, time                     date
show disk space                chkdsk                         df
show file              type                   cat
show file by screens   type filename | more   more
sort data              sort                   sort

Mais conteúdo relacionado

Mais procurados

Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Noé Fernández-Pozo
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystemroot_fibo
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commandsswtjerin4u
 
Unix / Linux Command Reference
Unix / Linux Command ReferenceUnix / Linux Command Reference
Unix / Linux Command ReferenceSumankumar Panchal
 
UNIX Command Cheat Sheets
UNIX Command Cheat SheetsUNIX Command Cheat Sheets
UNIX Command Cheat SheetsPrashanth Kumar
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manualdummy
 
The Linux Command Cheat Sheet
The Linux Command Cheat SheetThe Linux Command Cheat Sheet
The Linux Command Cheat SheetTola LENG
 
Unix Commands
Unix CommandsUnix Commands
Unix CommandsDr.Ravi
 
Unit 12 finding and processing files
Unit 12 finding and processing filesUnit 12 finding and processing files
Unit 12 finding and processing filesroot_fibo
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testingGaruda Trainings
 
Using the command line on macOS
Using the command line on macOSUsing the command line on macOS
Using the command line on macOSAdamFallon4
 

Mais procurados (19)

Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014
 
Linux cheat-sheet
Linux cheat-sheetLinux cheat-sheet
Linux cheat-sheet
 
Basic unix
Basic unixBasic unix
Basic unix
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystem
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commands
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
BIND DNS Configuration Red Hat 5
BIND DNS Configuration Red Hat 5BIND DNS Configuration Red Hat 5
BIND DNS Configuration Red Hat 5
 
Unix / Linux Command Reference
Unix / Linux Command ReferenceUnix / Linux Command Reference
Unix / Linux Command Reference
 
UNIX Command Cheat Sheets
UNIX Command Cheat SheetsUNIX Command Cheat Sheets
UNIX Command Cheat Sheets
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manual
 
The Linux Command Cheat Sheet
The Linux Command Cheat SheetThe Linux Command Cheat Sheet
The Linux Command Cheat Sheet
 
Basic Linux commands
Basic Linux commandsBasic Linux commands
Basic Linux commands
 
Unix Commands
Unix CommandsUnix Commands
Unix Commands
 
Unit 12 finding and processing files
Unit 12 finding and processing filesUnit 12 finding and processing files
Unit 12 finding and processing files
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Unix slideshare
Unix slideshareUnix slideshare
Unix slideshare
 
Using the command line on macOS
Using the command line on macOSUsing the command line on macOS
Using the command line on macOS
 

Destaque

Database Security Explained
Database Security ExplainedDatabase Security Explained
Database Security Explainedwensheng wei
 
什么是重要的事情?
什么是重要的事情?什么是重要的事情?
什么是重要的事情?wensheng wei
 
解读server.xml文件
解读server.xml文件解读server.xml文件
解读server.xml文件wensheng wei
 
20 种提升网页速度的技巧
20 种提升网页速度的技巧20 种提升网页速度的技巧
20 种提升网页速度的技巧wensheng wei
 
Java的垃圾回收之算法
Java的垃圾回收之算法Java的垃圾回收之算法
Java的垃圾回收之算法wensheng wei
 
如何一整天有精神,保持微笑
如何一整天有精神,保持微笑如何一整天有精神,保持微笑
如何一整天有精神,保持微笑wensheng wei
 
mysql的字符串函数
mysql的字符串函数mysql的字符串函数
mysql的字符串函数wensheng wei
 
详细介绍什么是Java虚拟机(JVM)介绍资料
详细介绍什么是Java虚拟机(JVM)介绍资料详细介绍什么是Java虚拟机(JVM)介绍资料
详细介绍什么是Java虚拟机(JVM)介绍资料wensheng wei
 
保护数据库服务器加强数据库安全
保护数据库服务器加强数据库安全保护数据库服务器加强数据库安全
保护数据库服务器加强数据库安全wensheng wei
 
超级入门:JAVA从零开始到HelloWorld
超级入门:JAVA从零开始到HelloWorld超级入门:JAVA从零开始到HelloWorld
超级入门:JAVA从零开始到HelloWorldwensheng wei
 
数据库系统安全防入侵技术综述
数据库系统安全防入侵技术综述数据库系统安全防入侵技术综述
数据库系统安全防入侵技术综述wensheng wei
 
JavaScript高级程序设计(中文优化版)
JavaScript高级程序设计(中文优化版)JavaScript高级程序设计(中文优化版)
JavaScript高级程序设计(中文优化版)wensheng wei
 
LINUX Admin Quick Reference
LINUX Admin Quick ReferenceLINUX Admin Quick Reference
LINUX Admin Quick Referencewensheng wei
 
LINUX System Call Quick Reference
LINUX System Call Quick ReferenceLINUX System Call Quick Reference
LINUX System Call Quick Referencewensheng wei
 

Destaque (17)

Database Security Explained
Database Security ExplainedDatabase Security Explained
Database Security Explained
 
什么是重要的事情?
什么是重要的事情?什么是重要的事情?
什么是重要的事情?
 
解读server.xml文件
解读server.xml文件解读server.xml文件
解读server.xml文件
 
20 种提升网页速度的技巧
20 种提升网页速度的技巧20 种提升网页速度的技巧
20 种提升网页速度的技巧
 
Java的垃圾回收之算法
Java的垃圾回收之算法Java的垃圾回收之算法
Java的垃圾回收之算法
 
JVM 学习笔记
JVM 学习笔记JVM 学习笔记
JVM 学习笔记
 
如何一整天有精神,保持微笑
如何一整天有精神,保持微笑如何一整天有精神,保持微笑
如何一整天有精神,保持微笑
 
mysql的字符串函数
mysql的字符串函数mysql的字符串函数
mysql的字符串函数
 
详细介绍什么是Java虚拟机(JVM)介绍资料
详细介绍什么是Java虚拟机(JVM)介绍资料详细介绍什么是Java虚拟机(JVM)介绍资料
详细介绍什么是Java虚拟机(JVM)介绍资料
 
保护数据库服务器加强数据库安全
保护数据库服务器加强数据库安全保护数据库服务器加强数据库安全
保护数据库服务器加强数据库安全
 
超级入门:JAVA从零开始到HelloWorld
超级入门:JAVA从零开始到HelloWorld超级入门:JAVA从零开始到HelloWorld
超级入门:JAVA从零开始到HelloWorld
 
数据库系统安全防入侵技术综述
数据库系统安全防入侵技术综述数据库系统安全防入侵技术综述
数据库系统安全防入侵技术综述
 
Subversion FAQ
Subversion FAQSubversion FAQ
Subversion FAQ
 
创新项目
创新项目创新项目
创新项目
 
JavaScript高级程序设计(中文优化版)
JavaScript高级程序设计(中文优化版)JavaScript高级程序设计(中文优化版)
JavaScript高级程序设计(中文优化版)
 
LINUX Admin Quick Reference
LINUX Admin Quick ReferenceLINUX Admin Quick Reference
LINUX Admin Quick Reference
 
LINUX System Call Quick Reference
LINUX System Call Quick ReferenceLINUX System Call Quick Reference
LINUX System Call Quick Reference
 

Semelhante a Treebeard's Unix Cheat Sheet

Basics of UNIX Commands
Basics of UNIX CommandsBasics of UNIX Commands
Basics of UNIX CommandsSubra Das
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdfamitkamble79
 
Lecture1 2 intro-unix
Lecture1 2 intro-unixLecture1 2 intro-unix
Lecture1 2 intro-unixnghoanganh
 
Linux commands
Linux commandsLinux commands
Linux commandsU.P Police
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.pptLuigysToro
 
Unix command line concepts
Unix command line conceptsUnix command line concepts
Unix command line conceptsArtem Nagornyi
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structureSreenatha Reddy K R
 
Unix Trainning Doc.pptx
Unix Trainning Doc.pptxUnix Trainning Doc.pptx
Unix Trainning Doc.pptxKalpeshRaut7
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsBITS
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2Gourav Varma
 
Linux directory commands:more options on cd and ls command
Linux directory commands:more options on cd and ls commandLinux directory commands:more options on cd and ls command
Linux directory commands:more options on cd and ls commandbhatvijetha
 
Using Unix
Using UnixUsing Unix
Using UnixDr.Ravi
 
Linux presentation
Linux presentationLinux presentation
Linux presentationNikhil Jain
 

Semelhante a Treebeard's Unix Cheat Sheet (20)

Linux
LinuxLinux
Linux
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Basics of UNIX Commands
Basics of UNIX CommandsBasics of UNIX Commands
Basics of UNIX Commands
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
 
Os lab manual
Os lab manualOs lab manual
Os lab manual
 
Lecture1 2 intro-unix
Lecture1 2 intro-unixLecture1 2 intro-unix
Lecture1 2 intro-unix
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
part2.pdf
part2.pdfpart2.pdf
part2.pdf
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.ppt
 
Unix command line concepts
Unix command line conceptsUnix command line concepts
Unix command line concepts
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
 
Unix Trainning Doc.pptx
Unix Trainning Doc.pptxUnix Trainning Doc.pptx
Unix Trainning Doc.pptx
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2
 
Linux directory commands:more options on cd and ls command
Linux directory commands:more options on cd and ls commandLinux directory commands:more options on cd and ls command
Linux directory commands:more options on cd and ls command
 
Using Unix
Using UnixUsing Unix
Using Unix
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 

Mais de wensheng wei

你会柔软地想起这个校园
你会柔软地想起这个校园你会柔软地想起这个校园
你会柔软地想起这个校园wensheng wei
 
几米语录(1)
几米语录(1)几米语录(1)
几米语录(1)wensheng wei
 
Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...wensheng wei
 
高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术wensheng wei
 
存储过程编写经验和优化措施
存储过程编写经验和优化措施存储过程编写经验和优化措施
存储过程编写经验和优化措施wensheng wei
 
CentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 ZendCentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 Zendwensheng wei
 
Happiness is a Journey
Happiness is a JourneyHappiness is a Journey
Happiness is a Journeywensheng wei
 
Java JNI 编程进阶
Java JNI 编程进阶     Java JNI 编程进阶
Java JNI 编程进阶 wensheng wei
 
Linux Shortcuts and Commands:
Linux Shortcuts and Commands:Linux Shortcuts and Commands:
Linux Shortcuts and Commands:wensheng wei
 
Java正则表达式详解
Java正则表达式详解Java正则表达式详解
Java正则表达式详解wensheng wei
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guidewensheng wei
 
Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法wensheng wei
 
如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10wensheng wei
 
数据库设计方法、规范与技巧
数据库设计方法、规范与技巧数据库设计方法、规范与技巧
数据库设计方法、规范与技巧wensheng wei
 
揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件wensheng wei
 
入门-Java运行环境变量的图文教程
入门-Java运行环境变量的图文教程入门-Java运行环境变量的图文教程
入门-Java运行环境变量的图文教程wensheng wei
 

Mais de wensheng wei (20)

你会柔软地想起这个校园
你会柔软地想起这个校园你会柔软地想起这个校园
你会柔软地想起这个校园
 
几米语录(1)
几米语录(1)几米语录(1)
几米语录(1)
 
我的简历
我的简历我的简历
我的简历
 
Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...
 
高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术
 
存储过程编写经验和优化措施
存储过程编写经验和优化措施存储过程编写经验和优化措施
存储过程编写经验和优化措施
 
CentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 ZendCentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 Zend
 
Happiness is a Journey
Happiness is a JourneyHappiness is a Journey
Happiness is a Journey
 
Java JNI 编程进阶
Java JNI 编程进阶     Java JNI 编程进阶
Java JNI 编程进阶
 
Linux Shortcuts and Commands:
Linux Shortcuts and Commands:Linux Shortcuts and Commands:
Linux Shortcuts and Commands:
 
Java正则表达式详解
Java正则表达式详解Java正则表达式详解
Java正则表达式详解
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guide
 
issue35 zh-CN
issue35 zh-CNissue35 zh-CN
issue35 zh-CN
 
Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法
 
如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10
 
ubunturef
ubunturefubunturef
ubunturef
 
数据库设计方法、规范与技巧
数据库设计方法、规范与技巧数据库设计方法、规范与技巧
数据库设计方法、规范与技巧
 
揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件
 
入门-Java运行环境变量的图文教程
入门-Java运行环境变量的图文教程入门-Java运行环境变量的图文教程
入门-Java运行环境变量的图文教程
 
Java学习路径
Java学习路径Java学习路径
Java学习路径
 

Último

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Último (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Treebeard's Unix Cheat Sheet

  • 1. Treebeard's Unix Cheat Sheet People who use Windows without DOS, or a Macintosh, or PPP without a terminal, or an ISP's menu without the Unix prompt are at a disadvantage. Something is happening, and they don't know what it is. I like to know what's really going on, so I've been learning some Unix. The Net is a Unix place. I'm no wizard, but I'm comfortable with basic commands and occasionally type "rm" at my DOS prompt instead of "del". This is my Unix cheat sheet, so I can remember. Uppercase and lowercase matter. These commands (mostly) work with my C-shell account on RAIN. Your account might be different, especially if your prompt ends with a "$" (Korn shell) rather than a "%", so be cautious. When I need help, I reach for the books UNIX in a Nutshell (O'Reilly) and Unix Unbound by Harley Hahn (Osborne/McGraw Hill, 1994). This page won't look right without table support. Most of this is available in a text version. Help on any Unix command. RTFM! Help on any Unix command. RTFM! Help on any Unix command. RTFM! man {command} Type man ls to read the manual for the ls command. man {command} > Redirect help to a file to download. {filename} whatis {command} Give short description of command. (Not on RAIN?) Search for all Unix commands that match keyword, eg apropos apropos {keyword} file. (Not on RAIN?) List a directory List a directory List a directory It's ok to combine attributes, eg ls -laF gets a long listing of all ls {path} files with types. ls {path_1} List both {path_1} and {path_2}. {path_2} ls -l {path} Long listing, with date, size and permisions. Show all files, including important .dot files that don't otherwise ls -a {path} show. ls -F {path} Show type of each file. "/" = directory, "*" = executable. ls -R {path} Recursive listing, with all subdirs. ls {path} > Redirect directory to a file. {filename} ls {path} | more Show listing one screen at a time. dir {path} Useful alias for DOS people, or use with ncftp. Change to directory Change to directory Change to directory cd {dirname} There must be a space between. cd ~ Go back to home directory, useful if you're lost. cd .. Go back one directory. cdup Useful alias, like "cd ..", or use with ncftp. Make a new directory Make a new directory Make a new directory mkdir {dirname} Remove a directory Remove a directory Remove a directory rmdir {dirname} Only works if {dirname} is empty.
  • 2. rm -r {dirname} Remove all files and subdirs. Careful! Print working directory Print working directory Print working directory Show where you are as full path. Useful if you're lost or pwd exploring. Copy a file or directory Copy a file or directory Copy a file or directory cp {file1} {file2} cp -r {dir1} {dir2} Recursive, copy directory and all subdirs. cat {newfile} >> Append newfile to end of oldfile. {oldfile} Move (or rename) a file Move (or rename) a file Move (or rename) a file mv {oldfile} Moving a file and renaming it are the same thing. {newfile} mv {oldname} {newname} Delete a file Delete a file Delete a file ? and * wildcards work like DOS should. "?" is any character; rm {filespec} "*" is any string of characters. Good strategy: first list a group to make sure it's what's you ls {filespec} think... rm {filespec} ...then delete it all at once. Download with Download with zmodem (Use sx with xmodem.) zmodem -a = ascii, -b = binary. Use binary for everything. (It's the sz [-a|b] {filename} default?) Handy after downloading with FTP. Go talk to your spouse while sz *.zip it does it's stuff. Upload with zmodem Upload with zmodem (Use rx with xmodem.) Give rz command in Unix, THEN start upload at home. Works rz [-a|b] (filename} fine with multiple files. View a text file View a text file View a text file more {filename} View file one screen at a time. less {filename} Like more, with extra features. cat {filename} View file, but it scrolls. cat {filename} | View file one screen at a time. more page {filename} Very handy with ncftp. pico {filename} Use text editor and don't save. Edit a text file. Edit a text file. Edit a text file. The same editor PINE uses, so you already know it. vi and pico {filename} emacs are also available.
  • 3. Create a text file. Create a text file. Create a text file. Enter your text (multiple lines with enter are ok) and press cat > {filename} control-d to save. pico {filename} Create some text and save it. Compare two files Compare two files Compare two files diff {file1} {file2} Show the differences. sdiff {file1} {file2} Show files side by side. Other text commands Other text commands Other text commands grep '{pattern}' Find regular expression in file. {file} sort {file1} > Sort file1 and save as file2. {file2} sort -o {file} {file} Replace file with sorted version. spell {file} Display misspelled words. wc {file} Count words in file. Find files on system Find files on system Find files on system find {filespec} Works with wildcards. Handy for snooping. find {filespec} > Redirect find list to file. Can be big! {filename} Make an Alias Make an Alias Make an Alias alias {name} Put the command in 'single quotes'. More useful in your .cshrc '{command}' file. Wildcards and Shortcuts Wildcards and Shortcuts Wildcards and Shortcuts Match any string of characters, eg page* gets page1, page10, * and page.txt. Match any single character, eg page? gets page1 and page2, ? but not page10. Match any characters in a range, eg page[1-3] gets page1, [...] page2, and page3. Short for your home directory, eg cd ~ will take you home, and ~ rm -r ~ will destroy it. . The current directory. .. One directory up the tree, eg ls ... Pipes and Pipes and Redirection (You pipe a command to another Redirection command, and redirect it to a file.) {command} > {file} Redirect output to a file, eg ls > list.txt writes directory to file. {command} >> Append output to an existing file, eg cat update >> archive {file} adds update to end of archive. {command} < {file} Get input from a file, eg sort < file.txt {command} < Get input from file1, and write to file2, eg sort < old.txt > {file1} > {file2} new.txt sorts old.txt and saves as new.txt. {command} | Pipe one command to another, eg ls | more gets directory and {command} sends it to more to show it one page at a time.
  • 4. Permissions, important and tricky! Permissions, important and tricky! Permissions, important and tricky! Unix permissions concern who can read a file or directory, write to it, and execute it. Permissions are granted or withheld with a magic 3-digit number. The three digits correspond to the owner (you); the group (?); and the world (everyone else). Unix permissions concern who can read a file or directory, write to it, and execute it. Permissions are granted or withheld with a magic 3-digit number. The three digits correspond to the owner (you); the group (?); and the world (everyone else). Think of each digit as a sum:
  • 6. Add the number value of the permissions you want to grant each group to make a three digit number, one digit each for the owner, the group, and the world. Here are some useful combinations. Try to figure them out! Add the number value of the permissions you want to grant each group to make a three digit number, one digit each for the owner, the group, and the world. Here are some useful combinations. Try to figure them out! chmod 600 You can read and write; the world can't. Good for files. {filespec} chmod 700 You can read, write, and execute; the world can't. Good for {filespec} scripts. chmod 644 You can read and write; the world can only read. Good for web {filespec} pages. You can read, write, and execute; the world can read and chmod 755 execute. Good for programs you want to share, and your {filespec} public_html directory. Permissions, another way Permissions, another way Permissions, another way You can also change file permissions with letters: You can also change file permissions with letters: u= use r (yo urs elf) g= gro up a= eve ryo ne r= rea d w = writ e x= exe cut e chmod u+rw {filespec}
  • 7. Give yourself read and write permission chmod u+x {filespec} Give yourself execute permission. chmod a+rw {filespec} Give read and write permission to everyone. Applications I use finger {userid} Find out what someone's up to. gopher Gopher. irc IRC, but not available on RAIN. lynx Text-based Web browser, fast and lean. ncftp Better FTP. pico {filename} Easy text editor, but limited. vi and emacs are available. pine Email. telnet {host} Start Telnet session to another host. tin Usenet. uudecode {filename} uuencode {filename} Do it on the server to reduce download size about 1/3. ytalk {userid} Chat with someone else online, eg ytalk mkummel. Please use w first so you don't interrupt a big download! System info date Show date and time. df Check system disk capacity. du Check your disk usage and show bytes in each directory. more /etc/motd Read message of the day, "motd" is a useful alias.. printenv Show all environmental variables (in C-shell% - use set in Korn shell$). quota -v Check your total disk use. uptime Find out system load. w Who's online and what are they doing?
  • 8. u= user (yo urse lf) g= gro up a= ever yon e r= read w= writ e x= exe cute chmod u+rw {filespec} Give yourself read and write permission chmod u+x {filespec} Give yourself execute permission. chmod a+rw {filespec} Give read and write permission to everyone. Applications I use finger {userid} Find out what someone's up to. gopher Gopher. irc IRC, but not available on RAIN. lynx Text-based Web browser, fast and lean. ncftp Better FTP. pico {filename} Easy text editor, but limited. vi and emacs are available. pine Email. telnet {host} Start Telnet session to another host. tin Usenet. uudecode {filename} uuencode {filename} Do it on the server to reduce download size about 1/3. ytalk {userid}
  • 9. Chat with someone else online, eg ytalk mkummel. Please use w first so you don't interrupt a big download! System info date Show date and time. df Check system disk capacity. du Check your disk usage and show bytes in each directory. more /etc/motd Read message of the day, "motd" is a useful alias.. printenv Show all environmental variables (in C-shell% - use set in Korn shell$). quota -v Check your total disk use. uptime Find out system load. w Who's online and what are they doing? chmod u+rw Give yourself read and write permission {filespec} chmod u+x Give yourself execute permission. {filespec} chmod a+rw Give read and write permission to everyone. {filespec} Applications I use Applications I use Applications I use finger {userid} Find out what someone's up to. gopher Gopher. irc IRC, but not available on RAIN. lynx Text-based Web browser, fast and lean. ncftp Better FTP. pico {filename} Easy text editor, but limited. vi and emacs are available. pine Email. telnet {host} Start Telnet session to another host. tin Usenet. uudecode {filename} Do it on the server to reduce download size about 1/3. uuencode {filename} Chat with someone else online, eg ytalk mkummel. Please use ytalk {userid} w first so you don't interrupt a big download! System info System info System info date Show date and time. df Check system disk capacity. du Check your disk usage and show bytes in each directory. more /etc/motd Read message of the day, "motd" is a useful alias.. Show all environmental variables (in C-shell% - use set in Korn printenv shell$). quota -v Check your total disk use. uptime Find out system load.
  • 10. w Who's online and what are they doing? Unix Directory Format Long listings (ls -l) have this format: - file d directory, * executable ^ symbolic links (?) file size (bytes) file name / directory ^ ^ ^ ^ ^ drwxr-xr-x 11 mkummel 2560 Mar 7 23:25 public_html/ -rw-r--r-- 1 mkummel 10297 Mar 8 23:42 index.html ^ ^^^ user permission (rwx) date and time last modified ^^^ group permission (rwx) ^^^ world permission (rwx) How to Make an Alias An alias lets you type something simple and do something complex. It's a shorthand for a command. If you want to type "dir" instead of "ls -l" then type alias dir 'ls -l'. The single quotes tell Unix that the enclosed text is one command. Aliases are more useful if they're permanent so you don't have to think about them. You can do this by adding the alias to your .cshrc file so they're automatically loaded when you start. Type pico .cshrc and look for the alias section and add what you want. It will be effective when you start. Just remember that if you make an alias with the name of a Unix command, that command will become unavailable. Here are a few aliases from my .cshrc file: # enter your aliases here in the form: # alias this means this alias h history alias m more alias q quota -v alias bye exit alias ls ls -F alias dir ls alias cdup cd .. alias motd more /etc/motd How to Make a Script A Unix script is a text file of commands that can be executed, like a .bat file in DOS. Unix contains a powerful programming language with loops and variables that I don't really understand. Here's a useful example. Unix can't rename a bunch of files at once the way DOS can. This is a problem if you develop Web pages on a DOS machine and then upload them to your Unix Server. You might have a bunch of .htm files that you want to rename as .html files, but Unix makes you do it one by one. This is actually not a defect. (It's a feature!) Unix is just being more consistent than DOS. So make a script! Make a text file (eg with pico) with the following lines. The first line is special. It tells Unix what program or shell should execute the script. Other # lines are comments. #! /bin/csh # htm2html converts *.htm files to *.html foreach f ( *.htm ) set base=`basename $f .htm` mv $f $base.html end Save this in your home directory as htm2html (or whatever). Then make it user-executable by typing chmod 700 htm2html. After this a * will appear by the file name when you ls -F, to show that it's executable. Change to a directory with .htm files and type ~/htm2html, and it will do its stuff.
  • 11. Think about scripts whenever you find yourself doing the same tedious thing over and over. Dotfiles (aka Hidden Files) Dotfile names begin with a "." These files and directories don't show up when you list a directory unless you use the -a option, so they are also called hidden files. Type ls -la in your home directory to see what you have. Some of these dotfiles are crucial. They initialize your shell and the programs you use, like autoexec.bat in DOS and .ini files in Windows. rc means "run commands". These are all text files that can be edited, but change them at your peril. Make backups first! Here's some of what I get when I type ls -laF: .addressbook my email addressbook. .cshrc my C-shell startup info, important! .gopherrc my gopher setup. .history list of past commands. .login login init, important! .lynxrc my lynx setup for WWW. .ncftp/ hidden dir of ncftp stuff. .newsrc my list of subscribed newsgroups. .pinerc my pine setup for email. .plan text appears when I'm fingered, ok to edit. .profile Korn shell startup info, important! .project text appears when I'm fingered, ok to edit. .signature my signature file for mail and news, ok to edit. .tin/ hidden dir of my tin stuff for usenet. .ytalkrc my ytalk setup. DOS and UNIX commands Action DOS UNIX change directory cd cd change file protection attrib chmod compare files comp diff copy file copy cp delete file del rm delete directory rd rmdir directory list dir ls edit a file edit pico environment set printenv find string in file find grep help help man make directory md mkdir move file move mv rename file ren mv show date and time date, time date show disk space chkdsk df
  • 12. show file type cat show file by screens type filename | more more sort data sort sort