- Published on
Basic Terminal Commands: kill, ping, uname, and passwd
- Authors
- Name
- Hieu Cao
Introduction
Linux provides a wide range of commands for managing processes, diagnosing network issues, gathering system information, and managing user accounts. This article introduces four fundamental commands—kill
, ping
, uname
, and passwd
—with practical examples to help you get started.
kill
Command: Managing Processes
The The kill
command is used to terminate processes by sending specific signals.
Syntax
kill [signal] PID
Common Use Cases
List running processes
ps aux
- Use this to find the process ID (PID).
Terminate a process
kill 1234
- Sends the default
SIGTERM
signal to terminate the process with PID1234
.
- Sends the default
Forcefully terminate a process
kill -9 1234
- Sends the
SIGKILL
signal to forcefully stop the process.
- Sends the
ping
Command: Network Diagnostics
The The ping
command checks the reachability of a network host and measures round-trip time.
Syntax
ping [options] destination
Common Use Cases
Ping a website
ping google.com
- Sends ICMP packets to check connectivity with
google.com
.
- Sends ICMP packets to check connectivity with
Set the number of packets
ping -c 5 google.com
- Sends exactly 5 ICMP packets.
Adjust packet size
ping -s 64 google.com
- Sends packets of size 64 bytes.
uname
Command: System Information
The The uname
command displays system information such as the operating system, kernel version, and machine hardware.
Syntax
uname [options]
Common Use Cases
Display basic system information
uname
- Shows the kernel name.
Show detailed system information
uname -a
- Displays all available information, including kernel version, hostname, and architecture.
Check the system architecture
uname -m
- Outputs the machine hardware name (e.g.,
x86_64
).
- Outputs the machine hardware name (e.g.,
passwd
Command: Password Management
The The passwd
command allows users to change their passwords or administrators to manage passwords for other users.
Syntax
passwd [options] [username]
Common Use Cases
Change your own password
passwd
- Prompts you to enter and confirm a new password.
Change another user’s password (as root)
sudo passwd username
- Allows an administrator to update the password for
username
.
- Allows an administrator to update the password for
Lock or unlock a user account
- Lock an account:
sudo passwd -l username
- Unlock an account:
sudo passwd -u username
- Lock an account:
Practical Example
Combine these commands in a workflow:
Kill an unresponsive process
ps aux | grep app kill -9 5678
Ping a server to check network connectivity
ping -c 4 example.com
View system details
uname -a
Update your password
passwd
Conclusion
The kill
, ping
, uname
, and passwd
commands are essential for process management, network diagnostics, system identification, and user security. Regular practice with these commands will enhance your efficiency and confidence in navigating the Linux terminal.