Common Unix Commands

Changing my Unix password

Please go to the link below if you wish to change your Unix password:

How do I change my Unix password?

Viewing the help files in Unix

The Unix system has a very complete and concise set of manuals that accompany every application that runs on the Operating System. These can be viewed using the man command, which is short for manual.

For example, if you wanted to view the man pages for the ls command you would type:

% man ls

Experiment with man by viewing all the man pages for the applications and commands that you are aware of.

Changing file permissions

chmod (change access permissions, change mode)

chmod changes the permissions of each given file according to mode, where mode describes the permissions to modify. Mode can be specified with octal numbers or with letters. Using letters is easier to understand for most people.

More information about the use of chmod can be found by visiting the following link:
The chmod Command

Checking the size of files and directories in Unix

To check the size of files and directories in your unix home area, type the following command at the Unix shell prompt:

% du

This will output the result in blocks of 512b increments.
If you would rather see the result in 1K blocks you can type:

% du -k

If you would rather see a summary for the whole directory and not the individual files inside the directories, you can type:

% du -sk *

Clearing the screen

clear (clear screen)

The terminal window of the previous commands can be cleared so that the output of the following commands can be clearly understood. At the prompt, type the following:

% clear

This will clear all text and leave you with the % prompt at the top of the window.

Finding out what type of system you are on

The uname command will provide useful information on system details.

uname -a reveals all details. Here are some example outputs:

% uname -a
SunOS student 5.10 Generic_141445-09 i86pc i386 i86pc
$ uname -a
Linux stulinux 3.2.0-52-generic #78-Ubuntu SMP Fri Jul 26 16:21:44 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

In the first example we are told that we are on a Sun Solaris (Version 5.10) system running on x86 hardware.

In the second example the command is informing us that we are operating on a Linux system running on an x86_64 hardware platform.

For more information on the uname command run: man uname.

Unix pipes

A pipeline is a convenient way to channel the output of one command into the input of another without creating an intermediate file. Let’s say we wanted to get an alphabetical listing of the current processes. From a thorough study of the previous section and the man pages for ps and sort, we already know how to do this:

ps -ef > processes
sort processes

This works, but it gives us a file (namely processes) which we don’t want. The vertical bar symbol, ‘|’ allows users to bypass this intermediate file. The above two commands can be replaced with the following:

ps -ef | sort

It is possible to connect a series of commands by additional pipe symbols. We could pass our previous output through the more paging program to obtain a more pleasing display of the results. This can be accomplished by typing:

ps -ef | sort | more

One important point to understand is that if a command isn’t capable of reading from standard input, it cannot be placed to the right of a vertical bar symbol.

More information can be found by visiting the following link:

http://freeengineer.org/learnUNIXin10minutes.html#Pipes

Summary

man command – view the man pages (help files)

checkquota – shows how much disk space you have left.

clear – clears the screen

uname – prints name of current system

Comments are closed.