0% found this document useful (0 votes)
40 views

Frused Unixcommnas

This document provides an overview of frequently used Unix commands organized into categories such as general commands, file system navigation, file/directory manipulation, and networking. It lists common commands like ls, cd, grep, sort, and includes brief descriptions. Additional resources for Unix documentation from ITCS are referenced at the end.

Uploaded by

api-3716519
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Frused Unixcommnas

This document provides an overview of frequently used Unix commands organized into categories such as general commands, file system navigation, file/directory manipulation, and networking. It lists common commands like ls, cd, grep, sort, and includes brief descriptions. Additional resources for Unix documentation from ITCS are referenced at the end.

Uploaded by

api-3716519
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Frequently Used Unix Commands 1 of 3

U-M Information Technology Central Services R1159 • November 2003

The Unix operating system supports many commands. To review a more complete definition of any
of the commands listed below, type man command at the Unix shell prompt (%), where you have
replaced command with the name of a Unix command. For example, type man exit to find out more
about the exit command.
NOTE: This document assumes you are using Unix on the ITCS Login Service (host name
login.itd.umich.edu). These instructions apply to many other Unix machines; however, you may
notice different behavior if you are not using the ITCS Login Service.
TIP: The variable files refers to a list of any number of files separated by white space; in the same
way; names refers to a list of file or directory names separated by white space.

Table of Contents
General .....................................................................................................................................1
File System Navigation...............................................................................................................1
File/Directory Manipulation.......................................................................................................1
Data Manipulation .....................................................................................................................2
Networking/Communications....................................................................................................2
Miscellaneous ............................................................................................................................2
Additional Resources .................................................................................................................2

General
apropos command Locate commands by keyword lookup.
exit Terminate your current session, or shell.
man command Display the Unix manual page describing a given Unix command.

File System Navigation


cd Return to your home directory.
cd directory Change directory to make directory your current directory.
file files Determine file type.
ls List the contents of the current directory.
ls names List the contents of the directories; names can name files and/or directories:
ls -l . . . in a long format, showing permissions, owner, size, and other file info.
ls -a . . . all files, including “hidden” files (file names that begin with a dot “.”).
ls -R . . . R ecursively, for all subdirectories.
ls -t . . . in time order (when modified, newest to oldest) rather than name order.
pwd Display the name of the current directory, or “print working directory.”

File/Directory Manipulation
compress files Reduces the size of a file.
uncompress files Restores compressed files to their original form.
cp file1 file2 Copy file(s).
cp files directory Copy file(s) into a directory.
Frequently Used Unix Commands 2 of 3

cp -r dir1 dir2 Copy a directory and, recursively, its subdirectories.


mkdir directory Create, or “make” a directory.
mv file1 file2 Move a file or, if file1 and file2 are in the same directory, rename a file.
mv files directory Move files into a directory.
mv dir1 dir2 If directory dir2 exists, move dir1 into dir2; otherwise, rename dir1 as dir2.
rm files Remove (erase) file(s).
rm -r names Remove files, directories, and recursively, any subdirectories.
rmdir directory Remove directory (directory must be empty).

Data Manipulation
cat files Concatenate file(s); you can use cat to display the contents of a file (this is not
advisable if the file is a binary file).
grep “pattern” files Display all lines in the files that match a pattern.
more files Display contents of files one screen at a time.
sort files Order the lines in a file or files alphabetically (this command does not alter
the file or files—it merely displays the sorted output to the screen):
sort -r files . . . in reverse order.
sort -n files . . . numerically (puts 2 before 10 instead of after).

Networking/Communications
finger [email protected] Displays information about a U-M user from the U-M Online Directory.
ssh hostname Connect to remote host using Secure Shell.
telnet hostname Connect to a remote host using the telnet protocol.
talk user Initiate a conversation with another user (end conversation with Control-C);
talk works only between machines of the same architecture

Miscellaneous
!! Repeat last shell command.
!string Repeat last shell command that began with string (for example, type “!m” to
repeat the last command that began with “m”).
cal Display a calendar of the current month.
cal month year Display a calendar of the given month and year. Note that the year must be
fully qualified, for example, “2003” and not “03.”
clear Clears terminal screen.
date Display the current local date and time.
who Display a list of users currently logged in.

Additional Resources
Visit ITCS’s Information System (http://www.itd.umich.edu/itcsdocs/) to obtain ITCS computer
documentation and other resources. A list of relevant documents follows.
Create, Copy, Rename, and Remove Unix Files and Directories (S4148)
List Contents and Navigate Unix Directories (S4149)
Using the Unix Text Editor Pico (R1168)
Frequently Used Unix Commands 3 of 3

Using the Unix Text Editor vi (R1172)

We welcome your comments; please send e-mail to [email protected].

ITCS’s Online Help Desk (http://www.itd.umich.edu/help/) provides a variety of computing help


resources.

You might also like