Lecture 2a - Common Unix Commands and Their Usage
Structure of a Unix Command
Unix Commands all have a similar structure:
COMMAND FLAGS PARAMETER(S)
Flags: Flags are options available on commands. Not all
commands need flags. Some REQUIRE them.
Note that spaces need to seperate the command from the
flags, and the flags from the parameters, and the
parameters from other parameters.
You can combine multiple flags under one - or have each
flag listed with it's own -
Useful Unix Commands
What do they do? How and why do we use these
Below is a small list of commands we
will go over in class. SOME of the flags useful with them
are listed as well.
- ls : list contents of a directory
items in specified directory.
- Flags: -l -a
(there's more too!)
- cat : view file contents
- more : view file contents, but pause each
screen. Page through each screen with space bar.
- less : view file contents, pause each screen,
space bar, use of arrow keys.
- touch : creates file or updates file timestamp
- cp : copy file to another file or location
- Flags: -i -r
- mv : move file to another file or location (move file
to another file, whaaaaaa?)
mv WhatToMove WhereToMoveTo
- rm : remove file (or directory... hmmmmm...)
- pwd : displays absolute pathname to current
- mkdir : create directory
- rmdir : remove directory (EMPTY ONES ONLY!)
- cd : (change directory) navigate
- wc : word count
- flags: -w -c
- passwd : use this command to change your account
- man : use the man command with any other command name
as a parameter to open up a manual page to see useage
notes and flags available with any unix command. (you can
also list any command name with --help afterwards to see
a smaller help page).
Back to Course Homepage
(c) Melina Vastola, 2015