Linux Commands Microproject
Linux Commands Microproject
Introduction
This microproject covers a series of essential Linux commands for basic system
interactions, user management, and service control. Each command includes a description,
sample usage, and example output to help understand its functionality.
date
Description: Displays the current date and time.
Usage: date
Example:
Sun Nov 10 12:34:56 UTC 2024
time
Description: Measures the time taken by a command to execute.
Usage: time <command>
Example:
time ls
cal
Description: Shows a calendar for the current month or a specific year.
Usage: cal or cal <year>
Example:
cal 2024
clear
Description: Clears the terminal screen.
Usage: clear
Example:
Screen is cleared
banner
Description: Displays text in a large ASCII format (may not be installed by default).
Usage: banner <text>
Example:
banner Hello
tty
Description: Prints the file name of the terminal connected to standard input.
Usage: tty
Example:
/dev/pts/0
script
Description: Records a terminal session to a file.
Usage: script <filename>
Example:
script session.txt
man
Description: Displays the manual page for a command.
Usage: man <command>
Example:
man ls
who am i
Description: Shows the current logged-in user's details.
Usage: who am i
Example:
user1 pts/0 2024-11-10 12:34
login
Description: Logs into the system (usually used at the start of a session).
Usage: login
Example:
Typically used during system boot for user login.
passwd
Description: Changes the user's password.
Usage: passwd
Example:
Only the root or the current user can change passwords.
su
Description: Switches to another user account or to root.
Usage: su <username>
Example:
su root
start
Description: Starts a specified service.
Usage: sudo service <service_name> start
Example:
sudo service apache2 start
stop
Description: Stops a specified service.
Usage: sudo service <service_name> stop
Example:
sudo service apache2 stop
restart
Description: Restarts a specified service.
Usage: sudo service <service_name> restart
Example:
sudo service apache2 restart
Tips
- Use the `man` command to explore each command further.
- Experiment with these commands in a Linux environment to gain practical experience.
- Try combining commands in scripts to automate repetitive tasks.