Linux · Basic Commands

Linux · Lesson 3

Basic Commands

Daily use Solaris terminal commands for system administrators. File operations, navigation and system information commands. Difference between Linux and Solaris behavior. Practical production examples.

Goal of this lesson

Before working with Linux users, services, networking or shell scripting, you must first become comfortable with the Linux terminal and essential command-line tools.

In this lesson, you will learn how to inspect Linux system information, move between directories, read files and check storage usage using safe beginner-friendly commands.

These commands are the foundation for almost every Linux administration and DevOps task you will perform later.

Core command-line concepts

System inspection

Commands like uname, hostname and date help administrators identify Linux versions, server names and environment details.

Filesystem navigation

Commands such as pwd, ls and cd allow you to safely move through Linux directories and inspect files.

Terminal productivity

Utilities like which, tty and bc improve command-line efficiency, troubleshooting and scripting workflows.

Step-by-step Linux command practice

The following examples demonstrate a realistic Linux terminal workflow. Practice every command carefully and observe how the shell prompt and command outputs change.

1. Check Linux system information

Use uname to identify the Linux kernel version, hostname and hardware platform.

terminal — bash
linux-lab
[root@linux ~]# uname -a
Linux linux 5.15.0-91-generic #101-Ubuntu SMP x86_64 GNU/Linux
 
[root@linux ~]# uname -r
5.15.0-91-generic

2. Display the current working directory

pwd shows the exact directory your current terminal session is using.

terminal — bash
linux-lab
[root@linux ~]# pwd
/root
 
[root@linux ~]# cd /var/log
 
[root@linux /var/log]# pwd
/var/log

3. Check system date and time

Use the date command to verify current server time and timezone settings.

terminal — bash
linux-lab
[root@linux ~]# date
Wed Jan 10 14:23:45 IST 2024

4. List files and directories

The ls command displays files and folders inside the current directory.

terminal — bash
linux-lab
[root@linux ~]# ls
backup.sh scripts notes.txt
 
[root@linux ~]# ls -lh
total 24K
-rwxr-xr-x 1 root root 2.1K Jan 10 11:15 backup.sh
-rw-r--r-- 1 root root 1.2K Jan 10 11:20 notes.txt
drwxr-xr-x 2 root root 4.0K Jan 10 11:18 scripts

5. Navigate between directories

Use cd to move through the Linux filesystem hierarchy safely.

terminal — bash
linux-lab
[root@linux ~]# cd /etc
 
[root@linux /etc]# pwd
/etc
 
[root@linux /etc]# cd ..
 
[root@linux /]#

6. Display file contents

The cat command quickly displays text files directly inside the terminal.

terminal — bash
linux-lab
[root@linux ~]# cat /etc/os-release
NAME="Ubuntu"
VERSION="22.04 LTS (Jammy Jellyfish)"

7. Check filesystem disk usage

df -h displays mounted filesystems and available disk space in human-readable format.

terminal — bash
linux-lab
[root@linux ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 50G 6.2G 41G 14% /
tmpfs 1.9G 0 1.9G 0% /run/user/0

8. Use the command-line calculator

bc provides simple arithmetic operations directly from the terminal.

terminal — bash
linux-lab
[root@linux ~]# bc
10+25
35
quit

9. Locate executable command paths

which identifies the binary that will execute when a command is entered.

terminal — bash
linux-lab
[root@linux ~]# which ls
/usr/bin/ls
 
[root@linux ~]# which bash
/usr/bin/bash

10. Identify the current terminal session

tty displays the pseudo-terminal device attached to the active session.

terminal — bash
linux-lab
[root@linux ~]# tty
/dev/pts/0

11. Display or change the hostname

The hostname command identifies the Linux server on a network.

terminal — bash
linux-lab
[root@linux ~]# hostname
linux
 
[root@linux ~]# hostnamectl set-hostname server1
 
[root@linux ~]# hostname
server1

Important command categories

Instead of memorizing commands randomly, it is better to group them by purpose. Most Linux commands fit into one of the following categories.

System information

Commands such as uname, date and hostname help identify kernel versions, time settings and server identity.

Navigation and file listing

Commands like pwd, ls and cd are used for navigating directories and viewing filesystem contents.

Viewing file contents

Commands such as cat, more, less and tail help administrators inspect configuration files and logs safely.

Getting help

The man command provides built-in Linux documentation and usage details for most commands.

Good command-line habits

Safe administration practices

  • Verify your current directory before modifying files or running scripts.
  • Use pwd and ls frequently to avoid accidental changes.
  • Read command outputs carefully instead of blindly executing commands.

Learning and troubleshooting

  • Use man pages regularly to understand command syntax and options.
  • Practice commands repeatedly inside your Linux lab environment.
  • Focus on understanding command behavior instead of memorizing outputs.

Important commands covered in this lesson

System and session information

  • uname -a → display complete Linux kernel information
  • uname -r → display Linux kernel release version
  • whoami → display currently logged-in user
  • date → display current date and system time

Navigation commands

  • pwd → show current working directory
  • ls → list files and directories
  • cd /path → move to another directory
  • cd .. → move one level upward

Viewing file contents

  • cat /etc/os-release → display Linux distribution information
  • more /var/log/syslog → read logs page by page
  • less /var/log/syslog → navigate large files easily
  • tail -f /var/log/syslog → monitor logs in real time

Processes and storage

  • df -h → display filesystem disk usage
  • du -sh * → display folder sizes
  • ps -ef → display complete process list
  • ps -ef | head → display only top process entries

Practice tasks for your Linux lab

  • Log in to your Linux virtual machine and execute every command shown in this lesson.
  • Record the outputs of uname -a,df -h and ps -ef | head to better understand your Linux environment.
  • Use the man command for at least three commands, such as man ls, man df andman ps.
  • Practice moving between directories and reading files until terminal navigation feels comfortable and natural.

In the next lesson, you will build on these commands while learning Linux user and group management.