You are on page 1of 3

HP-UX Quick Reference

The following table summarizes the most useful HP-UX commands. To make it easier to
refer to selected commands, copy or tear out these pages and place them near your
display.

How to use this Reference:

1. Type the commands as they are shown in the second column below.
2. Include paths with file names, if you are working with different directories.
3. Follow each command with Enter.
4. To get more information on a specific command, type man command_name.

To Do This ... Type This ...


Working with Directories
Show current working directory pwd

Change directory cd directory_path

Change to home directory cd

Create a directory mkdir directory_name

Remove an (empty) directory rmdir directory_name

Working with Files


Read mail elm

List files and directories in current directory ls

List all files or directories, including invisible ("dot") ls -a


files
List files, and mark directory names with "/" lsf

Compress a file compressfilename

Uncompress a file uncompressfilename

Create or edit a file vi file_name

Display file contents morefile_name (q to quit)


Display the first 10 lines of a file head file_name

Display the last 10 lines of a file tail file_name

Copy a file cp file_name file_copy

Move a file to a new file name mv old_file new_file


To Do This ... Type This ...
Append file1 onto the end of file2 cat file1 >> file2

Remove file rmfile

Remove a directory dir_name and all its files rm -rf dir_name

Check the spelling in a file spell file_name

Printing
Print a file lp file_name

Determine printer status lpstat -t

Cancel a print request cancelrequest_id

Finding and Organizing


Find file(s) beginning with x in current and
find . -name 'x*'
subdirectories
Find all occurrences of word in all files in current grep word *
directory
Sort listfile alphabetically sort listfile

Display date and time date

List all command aliases alias

Find HP-UX command information man command_name

Determine PATH setting echo $PATH

Determine what shell you're in echo $SHELL

Security Operations
Create or change password passwd

Display permissions for a file ll file_name

Display permissions for a directory ll -d directory_name


chmod class=permissions
Change file or directory permissions name

Change file or directory ownership chownusername

To Do This ... Type This ...


System Operations
Clear screen clear

Set command-line editor set -o editor_name

Edit your command line (in Korn/Key/Posix Shell set


ESC (use vi commands)
for vi)
To Do This ... Type This ...
Recall previous command line (with vi editor) ESCk (back) or j (forward)
Execute previous command line Enter (when line is displayed)
Set terminal type (select term_type from TERM=term_type
/usr/lib/terminfo)

List current process status and PIDs|ps -ef


Kill (terminate) a process kill PID

Create or change a password passwd

Redirect input from a file to a command command < infile

Connect two processes with a "pipe" command1 | command2

You might also like