Introduction to Unix commands

Introduction to Unix commands - Introduction to Unix...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Unix commands This is a very brief introduction to some useful Unix commands, including examples of how to use each command. For more extensive information about any of these commands, use the man command as described below. Sources for more information appear at the end of this document. Commands cal cat cd chmod cp date df du find jobs kill less and more lpr and lp ls man mkdir mv ps pwd rm rmdir set vi w and who cal This command will print a calendar for a specified month and/or year. To show this month's calendar, enter: cal To show a twelve-month calendar for 2008, enter: cal 2008 To show a calendar for just the month of June 1970, enter: cal 6 1970 For more, see In Unix, how can I display a calendar? cat This command outputs the contents of a text file. You can use it to read brief files or to concatenate files together.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
To append file1 onto the end of file2 , enter: cat file1 >> file2 To view the contents of a file named myfile , enter: cat myfile Because cat displays text without pausing, its output may quickly scroll off your screen. Use the less command (described below) or an editor for reading longer text files. For more, see In Unix, how do I combine several files into a single file? cd This command changes your current directory location. By default, your Unix login session begins in your home directory. To switch to a subdirectory (of the current directory) named myfiles , enter: cd myfiles To switch to a directory named /home/dvader/empire_docs , enter: cd /home/dvader/empire_docs To move to the parent directory of the current directory, enter: cd . . To move to the root directory, enter: cd / To return to your home directory, enter: cd chmod This command changes the permission information associated with a file. Every file (including directories, which Unix treats as files) on a Unix system is stored with records indicating who has permission to read, write, or execute the file, abbreviated as r, w, and x. These permissions are broken down for three categories of user: first, the owner of the file; second, a group with which both the user and the file may be associated; and third, all other users. These categories are abbreviated as u for owner (or user), g for group, and o for other.
Background image of page 2
To allow yourself to execute a file that you own named myfile , enter: chmod u+x myfile To allow anyone who has access to the directory in which myfile is stored to read or execute myfile , enter: chmod o+rx myfile You can view the permission settings of a file using the ls command, described below. Note: Be careful with the chmod command. If you tamper with the directory permissions of your home directory, for example, you could lock yourself out or allow others unrestricted access to your account and its contents. For more, see
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 33

Introduction to Unix commands - Introduction to Unix...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online