- This topic is empty.
- Post
-
- December 15, 2024 at 5:57 pm
Weekend WikiKeymasterHere are examples for each of the commands listed. Replace placeholders (e.g.,
<file>,<package>,<directory>) with actual values on your Ubuntu system:
System Information
uname -a
Example:uname -aOutput:
Linux ubuntu-PC 5.15.0-60-generic #66-Ubuntu SMP x86_64 GNU/Linux.lsb_release -a
Example:lsb_release -aOutput: Ubuntu version details.
hostnamectl
Example:hostnamectlOutput: Hostname and OS details.
uptime
Example:uptimeOutput:
08:24:56 up 1:23, 3 users, load average: 0.01, 0.02, 0.00.df -h
Example:df -hOutput: Disk space usage (e.g.,
/dev/sda1 50G 25G 25G 50% /).
File and Directory Management
ls
Example:ls -laOutput: Lists all files, including hidden ones, with detailed info.
cd <directory>
Example:cd /var/logpwd
Example:pwdOutput:
/var/log.mkdir <directory>
Example:mkdir my_projectrm <file>
Example:rm sample.txtcp <source> <destination>
Example:cp file1.txt /tmp/file1.txtmv <source> <destination>
Example:mv old_name.txt new_name.txt
Package Management
sudo apt update
Example:sudo apt updatesudo apt upgrade
Example:sudo apt upgradesudo apt install <package>
Example:sudo apt install curlsudo apt remove <package>
Example:sudo apt remove curldpkg -l
Example:dpkg -l
User Management
whoami
Example:whoamiOutput:
ubuntu.id
Example:idOutput:
uid=1000(ubuntu) gid=1000(ubuntu).sudo adduser <username>
Example:sudo adduser johnsudo deluser <username>
Example:sudo deluser john
Process Management
ps aux
Example:ps auxtop
Example:topkill <PID>
Example:kill 1234pkill <process_name>
Example:pkill firefox
Networking
ip a
Example:ip aping <domain/IP>
Example:ping google.comcurl <URL>
Example:curl http://example.comwget <URL>
Example:wget http://example.com/file.txt
File Permissions
chmod <permissions> <file>
Example:chmod 644 file.txtchown <owner>:<group> <file>
Example:sudo chown ubuntu:ubuntu file.txt
System Monitoring and Logs
dmesg
Example:dmesg | tailjournalctl
Example:journalctl -u apache2.servicetail -f <logfile>
Example:tail -f /var/log/syslog
Archiving and Compression
tar -cvf archive.tar <files>
Example:tar -cvf backup.tar file1.txt file2.txttar -xvf archive.tar
Example:tar -xvf backup.targzip <file>
Example:gzip file.txtgunzip <file>
Example:gunzip file.txt.gz
System Utilities
sudo reboot
Example:sudo rebootsudo shutdown now
Example:sudo shutdown nowhistory
Example:historyalias <name>='<command>'
Example:alias ll='ls -la'
Text File Management
cat <file>
Example:cat file.txtnano <file>
Example:nano file.txtless <file>
Example:less file.txtgrep <pattern> <file>
Example:grep 'error' file.txt
Let me know if you’d like examples tailored to a specific use case!
For consulting email us at [email protected]
- You must be logged in to reply to this topic.