operating_systems:linux
This is an old revision of the document!
Table of Contents
Linux Commands
This namespace contains documentation for the most commonly used Linux commands. Navigate the sections below to explore different categories of commands.
Navigation Commands
- pwd: Displays the current working directory.
- Example: `pwd`
- cd: Changes the current directory.
- Example: `cd /home/user/`
- ls: Lists files and directories.
- Example: `ls -l` (detailed view)
- Example: `ls -a` (includes hidden files)
- tree: Displays the directory structure as a tree.
- Example: `tree /home/user/`
File Manipulation Commands
- cp: Copies files or directories.
- Example: `cp file.txt /path/to/destination/`
- mv: Moves or renames files and directories.
- Example: `mv file.txt new_file.txt`
- rm: Removes files or directories.
- Example: `rm file.txt`
- For directories: `rm -r directory/`
- touch: Creates empty files or updates the access time.
- Example: `touch new_file.txt`
- cat: Displays the content of a file.
- Example: `cat file.txt`
- more: Displays file content one page at a time.
- Example: `more file.txt`
- less: Similar to more, but allows more flexible navigation.
- Example: `less file.txt`
- head: Displays the first few lines of a file.
- Example: `head file.txt`
- tail: Displays the last few lines of a file.
- Example: `tail file.txt`
- chmod: Changes file or directory permissions.
- Example: `chmod 755 file.txt`
- chown: Changes the ownership of a file or directory.
- Example: `chown user:group file.txt`
System Management Commands
- ps: Displays running processes.
- Example: `ps aux`
- top: Displays running processes in real-time.
- kill: Terminates a process.
- Example: `kill 1234` (where 1234 is the PID of the process)
- df: Displays disk space usage.
- Example: `df -h` (with human-readable units)
- du: Displays disk usage of files and directories.
- Example: `du -sh /directory`
- free: Displays free and used memory.
- Example: `free -h`
- uptime: Displays how long the system has been running.
- reboot: Reboots the system.
- shutdown: Shuts down the system.
- Example: `shutdown -h now`
Network Commands
- ping: Checks connectivity to another host.
- Example: `ping google.com`
- ifconfig: Displays network interfaces and their configuration.
- Example: `ifconfig`
- ip: Configures and displays network interfaces.
- Example: `ip a`
- netstat: Displays network connections and statistics.
- Example: `netstat -tuln`
- wget: Downloads files from the web.
- Example: `wget http://example.com/file.zip`
- curl: Makes HTTP requests.
- Example: `curl http://example.com`
Compression Commands
- tar: Archives and extracts files.
- Example to compress: `tar -czvf archive.tar.gz /directory/`
- Example to extract: `tar -xzvf archive.tar.gz`
- zip: Compresses files.
- Example: `zip archive.zip file1.txt file2.txt`
- unzip: Extracts zip files.
- Example: `unzip archive.zip`
- gzip: Compresses files into .gz format.
- Example: `gzip file.txt`
- gunzip: Extracts .gz files.
- Example: `gunzip file.txt.gz`
User Commands
- useradd: Creates a new user.
- Example: `useradd new_user`
- usermod: Modifies user properties.
- Example: `usermod -aG sudo user`
- passwd: Changes a user's password.
- Example: `passwd user`
- whoami: Displays the current user name.
- id: Displays user and group information.
- groups: Displays the groups a user belongs to.
- Example: `groups user`
Search Commands
- find: Searches for files and directories.
- Example: `find /path -name “*.txt”`
- locate: Locates files quickly using a database.
- Example: `locate file.txt`
- grep: Searches for text within files.
- Example: `grep “text” file.txt`
Other Useful Commands
- man: Displays the manual page for a command.
- Example: `man ls`
- history: Displays the command history.
- alias: Creates an alias for a command.
- Example: `alias ll='ls -l'`
- clear: Clears the terminal screen.
Sources
- [Linux Documentation](https://www.kernel.org/doc/) - [Man Pages](https://man7.org/linux/man-pages/)
operating_systems/linux.1738929695.txt.gz · Last modified: 2025/02/07 12:01 by jmbargallo
