Solaris Quick Reference
- Telnet, workstation, or console
- Log In
Type your username at the login prompt.
Type your password at the password prompt.
- Change Password
Type yppasswd. Enter your old password, then enter your new password. You'll be asked to enter the new passwd
again to make sure there are no typing errors.
- Log Out
If you are in OpenWindows click the 3rd mouse button over the background, then choose Exit from the Menu.
Otherwise, type logout.
- File System
- Create File
type cat > filename, then text ending with CNTRL-D.
- See Editing Files for how to use vi and emacs.
- Make (or Create) Directory
Type mkdir directory-name.
- Look at File
Type cat filename
or more filename.
- Print File
Type lpr filename.
- List Files and Directories
ls for listing of current directory.
ls directory-name for listing of another directory.
ls filename for listing of a single file.
ls -lt to get a listing reverse sorted by time of last modification
- Move or Rename Files and Directories
mv source-filename destination-filename to rename a file
mv source-filename destination-directory to move a file into anoter directory
mv source-directory destination-directory
to rename a directory (if destination-directory does NOT exist)
to move the source-directory into the desitantion-directory (if the destination-directory exists).
- Copy Files
cp source-filename destination-directory to copy a file into another directory
cp source-filename destination-filename to copy a file into another filename
- Remove (or Delete) File
rm filename to remove a file
rmdir directory-name to remove an empty directory
rm -r directory-name to remove a directoyr and its conteents
- Change Working Directory
Type cd to chande directories to your home directory
cd directory-name to change directories to another directory
- Find Name of Current Directory
simple: One filename or directory name to access a local file or directory.
absolute: List of directory names from the root directory (first /) to
- desired filename or directory name. (pwd list the absolute path.)
relative: List of directory names from current position to desired
- filename or directory name.
- Directory Abbreviation
~/ Home directory
~username/ Another user's home directory
. Working directory
.. Parent of working directory
- Date and Time
Type date to find out the date and time.
Type date -u for universal time (Greenwich Mean Time).
cal year for yearly calendar
cal month-number year for monthly calendar
- Wild Cards
? Single character wild card
* Arbitrary number of characters
- Redirecting Output
System types output of command to file rather than screen, replacing current contents of file, if any.
Type command-name > filename
System types output of command to file rather screen, appending to current contents fo file, if any.
Type command-name >> filename
- Search Files
grep search-string filename to type out lines containing the string in a specific file
grep -v search-string filename to type out lines that do NOT containing the string
command | grep search-string to find the lines containg the sting in the output of command.
(example: history | grep history)
To "alias", or abbreviate a command string:
- Create a .aliases file in your home directory, if it doesn't already exist.
- Edit the dot aliases file. Each alias should have the form:
alias alias-string command-string
- alias h 'history'
- alias cd.. 'cd ..'
- alias gms '/usr/local/GMS/gms -r /usr/local/GMS/')
- The aliases will start to work after you login again
type source ~/.aliases to start using the new aliases now.
- History:Command Repetition
history to lists the commands you have used in order.
!! to repeat the entire last command line at any point in the current command line.
!command-number to repeat the command with command-number from the history list.
- (Type history to find out the command-number. The command-number
- is the number in the left most column.)
!$ to repeat the last word of the last command line at any point in the currrent command line.
- Run Command in Background: Job Control
To run a command in the background,as opposed to the more common method of running commands in the foreground,
type a & after the command line. Then you can type more commands to the command prompt, or even run more commands
in the background for simultaneous command execution.
- Online Documentation
man command-name to see the online Man Pages for a certain command.
man -k key-word to get a listing of commands that have key-word in their description.