Unix Commands
Unix Commands
At any time you can determine where you are in the file
system hierarchy with the pwd, print working directory,
command
Ex: $ pwd
/home/username
cd – change directory
You can change to a new directory with the cd, change
directory, command. Cd will accept both absolute and
relative path names.
Ex: cd directory
cont…
cd – change directory
Examples
cd (also chdir in some shells) change directory
cd Changes to user’s home directory
cd / Changes directory to the systems’ root
cd .. Goes up one directory level
cd ../.. Goes up two directory levels
To preventthe line feed: $ echo –n Hello Class or echo “Hello Class \c”
Where the style to use in the last example depends on the echo command in use.
The \x options must be within pairs of single or double quotes, with or without other
string characters.
Internal Controls:
More Display (one screen at a time) the file requested
<space bar> to view next screen
<return> or <CR> to view one more line
q, h, b to quit viewing the file, help, go back up one screenful
/word search for word in the remainder of the file
Less similar to more,
head – display the start of a file
head displays the head, or start, of the file.
Syntax: head [options] file
Common Options:
-n number number of lines to display, counting from the top of the file
-number same as abouve
Example:
By default head displays the first 10 lines. You can display more with the “-n number”, or
“-number” options, e.g., to display the first 40 lines:
$ head -40 filename or head –n 40 filename
chsh (passwd –e/-s) username login_shell Change the user’s login shell
date [options] Report the current date and time
man [options] command Show the manual (man) page for a command