Linux basics: commands
2024-02-11
Linux is an open-source operating system kernel used as the foundation for a wide range of operating systems, known as Linux distributions. It provides a robust and customizable environment for computing, suitable for diverse applications, from servers to personal devices. Linux supports multitasking, multiuser capabilities, and a secure, permission-based file system. It is widely employed in server environments due to its stability, security features, and efficiency. As a versatile and freely accessible operating system, Linux plays a crucial role in empowering developers, system administrators, and organizations to build and manage computing infrastructure.
Commands
System Information
ls
- List directory contents.pwd
- Print name of current/working directory.cd
- Change directory.man
- Display manual pages for commands.uname
- Print system information.
File Operations
cp
- Copy files and directories.mv
- Move/rename files and directories.rm
- Remove/delete files or directories.mkdir
- Create directories.rmdir
- Remove empty directories.
Text Processing
cat
- Concatenate and display files.grep
- Search for patterns in files.sed
- Stream editor for filtering and transforming text.awk
- Pattern scanning and text processing language.
File Viewing and Editing
less
- View file contents interactively.head
- Output the first part of files.tail
- Output the last part of files.nano
- Terminal text editor.vim
- Powerful text editor.
Process Management
ps
- Report a snapshot of the current processes.top
- Display and update sorted information about processes.kill
- Send signals to processes.
System Control
shutdown
- Shutdown or restart the system.reboot
- Reboot the system.halt
- Halt the system.
Package Management
apt-get
(orapt
on newer systems) - Command-line tool for handling packages.dpkg
- Debian package manager.yum
- Package manager for RPM-based Linux distributions.
Network
ping
- Send ICMP ECHO_REQUEST to network hosts.ifconfig
- Configure network interfaces.ssh
- OpenSSH SSH client (remote login program).scp
- Secure copy (remote file copy program).
User Management
useradd
- Create a new user or update default new user information.userdel
- Delete a user account and related files.passwd
- Update a user's authentication tokens.
Compression and Archiving
tar
- Tape archive utility.gzip
- Compress or decompress files.zip
- Package and compress (archive) files.
Disk Usage
df
- Report file system disk space usage.du
- Estimate file space usage.
Permissions
chmod
- Change file mode bits (permissions).chown
- Change file owner and group.
Miscellaneous Utilities
date
- Display or set the system date and time.echo
- Display a line of text/string.wc
- Print newline, word, and byte counts for each file.find
- Search for files in a directory hierarchy.
Environment
export
- Set environment variables.source
- Execute commands from a file in the current shell.alias
- Create or list command aliases.history
- Command history list.
Each of these commands plays a crucial role in Linux system administration and daily usage, covering a wide range of tasks from basic file manipulation to system control and network management.
Last updated