Unix Commands: Basic and Advanced Unix Commands with Examples

In this tutorial, you will learn different basic and advanced Unix Commands.

Unix commands are inbuilt programs that can be invoked in multiple ways.

Here, we will work with these commands interactively from a Unix terminal. A Unix terminal is a graphical program that provides a command line interface using a shell program. 

This tutorial will provide a summary of some of the common basic and advanced unix commands along with the commonly used syntax for those commands.

This tutorial is divided into 6 parts.

Useful Commands in Unix – Tutorials List

  1. Unix Basic and Advanced Commands (cal, date, banner, who, whoami ) (this tutorial)
  2. Unix File System Commands (touch, cat, cp, mv, rm, mkdir)
  3. Unix Processes Control Commands (ps, top, bg, fg, clear, history)
  4. Unix Utilities Programs Commands (ls, which, man, su, sudo, find, du, df)
  5. Download – Basic Unix Commands
  6. Download – Advanced Unix Commands

No matter whether you are working on a stand-alone or web-based project, knowledge of Operating Systems and Networking is must for the testers.

Many testing activities like installation and performance testing are dependent on operating system knowledge. Nowadays, most of the web servers are Unix based. So Unix knowledge is mandatory for the testers.

If you are a beginner to Unix then starting to learn Unix commands can be a good start.

The best way to learn these commands is to read and simultaneously practice them on Unix Operating System.

NOTE: For the reminder of this course, you will need access to a Unix installation to try the exercises. For Windows users, you can follow the instructions at this link to install Ubuntu using VirtualBox.

Logging into Unix

Once the Unix system startup is complete, it will show a login prompt for the user to enter their username and password. If the user enters a valid username and password, then the system will log in the user and start a login session. After this, the user can open a terminal that runs a shell program.


The shell program provides a prompt where the user can proceed with running their commands.

Logging out of Unix

When the user wishes to end their session, they can terminate their session by logging out of the terminal or the system. To log out of a login terminal, the user can simply enter Ctrl-D or exit – both of these commands will, in turn, run the logout command that ends the login session.

*********************************

Let’s start with 1st part of this Unix Commands series. 

Basic Unix Commands (Part A)

In this tutorial, we will see how to log into and log out of Unix. We will also cover some basic Unix commands like cal, date, and banner.

Unix Video #2:

#1) cal: Displays the calendar.

  • Syntax: cal [[month] year]
  • Example: display the calendar for April 2018
    • $ cal 4 2018

#2) date: Displays the system date and time.

  • Syntax: date [+format]
  • Example: Display the date in dd/mm/yy format
    • $ date +%d/%m/%y

#3) banner: Prints a large banner on the standard output.

  • Syntax: banner message
  • Example: Print “Unix” as the banner
    • $ banner Unix

#4) who: Displays the list of users currently logged in

  • Syntax: who [option] … [file][arg1]
  • Example: List all currently logged in users
    • $ who

#5) whoami: Displays the user id of the currently logged in user.

  • Syntax: whoami [option]
  • Example: List currently logged in user
    • $ whoami

Watch out our upcoming tutorial Unix Commands Part B.

PREV Tutorial | NEXT Tutorial