Few Important General purpose Unix/linux commands.

In todays date the open supply operating system that’s very powerful and used broadly by maximum of the users/ other industry and IT productions based companies. I hope you should have heard approximately the Unix/Linux OS. Here am going to provide an explanation for few basic/general motive utilities of the powerful OS. Not writing plenty just going to explain in easy word.

1. cal : The Calender

Open your terminal and just type this command and see what is the output coming. You can invoke this(cal) command to see the calendar of the current or any specific month or a complete year.


For Current month-year –> cal

For specific month-year –> cal [ [month] year] for example cal 01 2020 (the output will be calendar of Jan 2020)

2. date : Displays the system date

Use this command to see the current system date and time with seconds. This command can be used with few suitable format specifiers as arguments.Each format is represented by + symbol followed by % operator.

For example:

If you want to see the current month the argument is

$ date +%m ↵


And the month name

$ date +%h ↵


Few of the format specifiers are listed below

d –> the day of the month

H, M & S –> The hour , minute and second respectively.

T –> Time format in hh:mm:ss

y–> last digit of the year

3. bc: Calculator

Unix/Linux based system provides a text based calculator which can be run using the bc utility in the terminal.

$ bc ↵





ctrl+d to exit

4.echo: Displaying message

This echo command is used to see a message on the terminal. This command is often used in shell scripts to display diagnostic messages on the terminal, or to issue prompts for taking user input.

For example:

To see the current running shell in your system

$ echo $SHELL ↵


To see a message

$ echo https://thecloudiary.com/


5. printf : Displaying a message

It is an alternate to echo command , printf is the command which everyone should use instead of echo (unless you have to maintain a lot of legacy code that use echo).

6. script: Record your session

Use this command to record your session in a file. This helps to record the login session. Suppose you are doing some important work in the terminal and you want to keep the log file you worked you can invoke the command immediately you login to your system.

$ script ↵

Script started, output file is typescript

$ date ↵

Sun Apr 26 21:57:58 IST 2020


Script done, output file is typescript.

Now you can view the file using cat or vi editor.

7. passwd: Changing your password

When a user wants to change his/her login password, just simply run the command passwd then see

$ passwd ↵

Changing password for admin

Enter login password: xxxxxx

New password: xxxxxx

Re-enter password: xxxxxx

passwd: passwd successfully changed for kumar

8. who: Who are the users ?

UNIX/Linux maintains an account of all users who are logged on to the system. The who command displays an informative listing of the users.

$ who ↵

user1 console Apr 2 20:14

user2 ttys000 Apr 10 13:12

9. uname: Know your machine’s characteristics

The uname utility writes symbols representing one or more system characteristics to the standard output.

There are few options to know the characteristics of your system discussed below.

The following options are available:

-a Behave as though all of the options -mnrsv were specified.

-m print the machine hardware name.

-n print the nodename (the nodename may be a name that the system is known by to a communications network).

-p print the machine processor architecture name.

-r print the operating system release.

-s print the operating system name.

-v print the operating system version.

If no options are specified, uname prints the operating system name as if the -s option had been specified.

9. mailx

The mailx is a UNIX/Linux utility program for sending and receiving mail. mailx is invoked with the email address of the recipient in the sending mode , and without arguments in the receiving mode. The command can also be used non-interactively form shell scripts.

10. tty: know your terminal

This command is used to know your terminal. There is no argument for this command.

$ tty ↵


You can use tty in shell scripts to control the behaviour of the script depending on the terminal it is invoked from.

11. stty

UNIX/Linux users can use this command to display and set terminal characteristics.

The stty utility sets or reports on terminal characteristics for the device that is its standard input. If no options or operands are specified, it reports

the settings of a subset of characteristics as well as additional ones if they differ from their default values. Otherwise it modifies the terminal state

according to the specified arguments. Some combinations of arguments are mutually exclusive on some terminal types.

The following options are available:

-a Display all the current settings for the terminal to standard output as per IEEE Std 1003.2 (“POSIX.2”).

-e Display all the current settings for the terminal to standard output in the traditional BSD “all” and “everything” formats.

-f Open and use the terminal named by file rather than using standard input. The file is opened using the O_NONBLOCK flag of open(), making it possible

to set or display settings on a terminal that might otherwise block on the open.

-g Display all the current settings for the terminal to standard output in a form that may be used as an argument to a subsequent invocation of stty to

restore the current terminal state as per IEEE Std 1003.2 (“POSIX.2”).

The following arguments are available to set the terminal characteristics.

Use stty sane to set the terminal to some standard values.

Leave a Reply

Your email address will not be published. Required fields are marked *