Linux operating systems are known for their power and flexibility, especially in technical and academic environments. A large part of this power lies in the Command Line Interface (Terminal), which grants users full control over the system and the ability to execute complex tasks efficiently. In this comprehensive guide, we will explore how to leverage command line tools to manage email, communication, file editing, and more.
Using email through a black screen may seem outdated, but it remains a vital tool for system administrators and developers for automating notifications and tasks. The primary tool is the mail
program.
Sending an email from the terminal is one of the simplest yet most effective tasks. All you need is the mail
command followed by the recipient’s email address.
Practical example:
Suppose you want to send a message to user ahmed
on the same server:
mail [email protected]
After running the command, the system will prompt you to enter the subject of the message. Keep it brief and clear. After pressing Enter
, you can start typing the body of the message. To finish and send, press Enter
to move to a new line, then type a single period (.
) and press Enter
again.
Ctrl+C
at any time if you change your mind.When you receive a new email, the system usually notifies you upon login. To read your messages, type:
mail
The system will display a numbered list of messages with sender, date, and subject.
/var/spool/mail/user: 2 messages 2 new
> N 1 [email protected] Fri Nov 1 10:51 System Maintenance Alert
N 2 [email protected] Fri Nov 1 10:54 Regarding our meeting
1
).d
followed by the message number (e.g., d 2
).r
followed by the message number (r 1
).s
, followed by the message number and filename (e.g., s 1 alert.txt
).Pro tip: The mail
utility depends on a Mail Transfer Agent (MTA) like Postfix or Sendmail installed on the system. These tools handle the actual sending of emails over the network. For users who want a more advanced terminal-based mail client, consider exploring Mutt.
Besides email, Linux offers classic tools for direct communication, which were essential before the rise of instant messaging apps.
finger
CommandThe finger
command lets you retrieve information about users logged into the same or another networked system.
finger
finger username@hostname
Security note: In modern networks, finger
is often disabled due to security concerns. Safer alternatives include the commands who
and w
.
talk
CommandThe talk
command allows you to open a real-time text chat session with another user.
talk username@hostname
When the other user accepts, the terminal screen splits, enabling both users to type simultaneously. Like finger
, talk
usage has declined and been replaced by more secure and feature-rich tools such as SSH chats or dedicated messaging applications.
The command line is a natural environment for developers. Here's how to work with files and programs.
Emacs is one of the most powerful and oldest text editors available.
emacs my_program.c
This opens the file in Emacs’ text interface. Emacs is famous for its extensible ecosystem and ability to handle everything from coding to task management. Learn more on the official GNU Emacs website.
After writing source code, you need to compile it into an executable program.
gcc my_program.c -o my_program
The -o
flag specifies the output executable's name. Discover more about GNU compilers on the official GCC page.
./my_program
To print the contents of a text file or source code, use the lp
command:
lp my_program.c
Extra tip: To print an entire session’s commands and output, use the script
command to record everything to a text file, then print that file.
script session_log.txt
# run your commands here...
exit
lp session_log.txt
Linux offers a comprehensive set of tools that work in perfect harmony through the command line, giving users unparalleled efficiency in managing tasks. From sending a simple email to compiling complex programs, these commands remain the cornerstone of the Linux experience, unlocking deeper control and automation. Mastering these tools is not just a technical skill — it’s an investment in understanding the core workings of digital systems.