Home | Login and Logout | Basic Command Line Commands | File System | File Editing Through Terminal | Java Programs | Input/Output Redirection | Grep | Works Cited

Basic Command Line Commands

The following tutorial gives a basic overview of how to perform some basic functions using the command line in linux. To skip to a certain section, please click a link below:

Getting the Date and Time

Simple Date and Time
Getting the current system time and date can be accomplished by using the date command in the linux terminal.
This will display the date and time in the follwing format:
[Abbreviated Day of Week] [Abbreviated Month] [Day of Month] [Time 24hr Format] [Timezone] [Year]
For example: "Fri Oct 20 20:03:53 CDT 2017"


Complex Date and Time
More complex formatting for the date and time can be accomplished by creating a string with different tokens to represent the output of a section of the date in a specific format.
For example, if I would like the date to appear as:
Today's date is: [Full Month] [Date of Month], [Year] and the time is: [Time 24hr Format]
I can enter the following into command line:
date +"Today's date is: %B %d, %Y and the time is: %T"
This will display as: "Today's date is: October 20, 2017 and the time is: 20:05:24 ".


For a full list of the tokens that can be used with the date command, enter
"date --help"
into the command terminal.

Getting a List of the Current Machine Users

Users Command
For a simple list of currently logged in users, utilize the users command. This will display a list of users in alphabetical order:


Who Command
To find a list of currently logged in users and when they logged in, you may use the who command. This will display a list in the following format: (IP adresses of users have been removed)


To display the headings for the columns of the list, use the -H flag. To enter this flag type the following into the terminal:
who -H


For a full list of available flags using the who command, enter
"who --help"
into the command terminal.


Written by: Daniel Amusin, Derek DeCramer, Nikhil Thammadi