User Tools

Site Tools


ubuntu:bash:commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ubuntu:bash:commands [2019/11/29 00:40] – created peterubuntu:bash:commands [2019/12/07 01:35] (current) – removed peter
Line 1: Line 1:
-====== Commands ====== 
- 
-===== System ===== 
- 
-| ^Command^ 
-|Display linux system information|uname -a| 
-|Display kernel release information|uname -r| 
-|Show how long a system has been running|uptime| 
- 
----- 
- 
-===== Archiving / Compression ===== 
- 
-| ^Command^ 
-|Create a tar file containing a directory|tar cf home.tar /home| 
-|Create a tar file with gzip compression|tar czf tarfile.tar.gz files| 
-|Extract files from a tar file|tar xf filename.tar| 
-|Compress file and rename it to filename.gz|gzip filename| 
- 
----- 
- 
-===== Booting ===== 
- 
-| ^Command^ 
-|Show boot messages|dmesg| 
-|Show system reboot history|last reboot| 
- 
----- 
- 
-===== Date and Time ===== 
- 
-| ^Command^ 
-|Show current date and time|date| 
- 
----- 
- 
-===== File and Disk ===== 
- 
-| ^Command^ 
-|Display all information on files and directories|ls -a| 
-|Show path of current directory|pwd| 
-|Create a directory|mkdir dirname| 
-|Delete a file|rm filename| 
-|Delete a directory recursively|rm -r dirname| 
-|Forcefully delete a file|rm -f filename| 
-|Forcefully delete a directory recursively|rm -rf dirname| 
-|Copy file1 to file2|cp file1 file2| 
-|Copy directory1 to directory2, create directory2 if it does not exist|cp -r dirname1 dirname2| 
-|Create a symbolic link to a filename|ln -s /path/to/filename linkname| 
-|Create or update a file|touch filename| 
-|Place standard input into a file|cat > filename| 
-|Output contents of file|more file| 
-|Output first 10 lines of file|head file| 
-|Output last 10 lines of file|tail file| 
-|Output contents of file as it grows starting with last 10 lines|tail -f filename| 
-|Encrypt file|gpg -c filename| 
-|Decrypt file|gpg filename.gpg| 
-|Print the number of chars, words and lines in a file|wc filename| 
-|Execute command lines from standard input|xargs| 
-|Change permission of a file|chmod 666 filename| 
- 
----- 
- 
-===== Disk Usage ===== 
- 
-| ^Command^ 
-|Show free space on mounted filesystems|df -h| 
-|Show free inodes on mounted filesystems|df -i| 
-|Show disk partition sizes and types|fdisk -l| 
-|Display disk usage|du -ah| 
-|Display total disk usage on the current directory|du -sh| 
-|Display mount points for all filesystems|findmnt| 
-|Mount a device|mount device-path mount-point| 
- 
----- 
- 
-===== File Transfer ===== 
- 
-| ^Command^ 
-|Secure copy file to host|scp file.txt server2:/tmp| 
-|Synchronize source to destination|rsync -a /home/peter /backup/| 
- 
- 
----- 
- 
-===== Hardware ===== 
- 
-| ^Command^ 
-|Display CPU information|cat /proc/cpuinfo| 
-|List the number of interupts per CPU per I/O device|cat /proc/interrupts| 
-|List hardware configuration information|lshw| 
-|Display block device related information|lsblk| 
-|Display PCI devices|lspci -tv| 
-|Show USB devices|lsusb -tv| 
-|Show BIOS information|dmidecode| 
-|Show disk information|hdparm -i /dev/sda| 
-|Perform a disk speed test|hdparm -tT /dev/sda| 
-|Test for unreadable blocks on a disk|badblocks -s /dev/sda| 
- 
----- 
- 
-===== Login ===== 
- 
-| ^Command^ 
-|Connect to host as user|ssh user@host| 
-|Connect to host using specific port|ssh -p port user@host| 
-|Connect to host using telnet port|telnet host| 
- 
----- 
- 
-===== Memory ===== 
- 
-| ^Command^ 
-|Display used and free memory|free -m| 
- 
----- 
- 
-===== Network ===== 
- 
-| ^Command^ 
-|Show the system hostname|hostname| 
-|Display IP address of the host|hostname -i| 
-|Display all network interfaces and IP addresses|ip addr show| 
-|Display network interfaces and IP addresses for an interface|ip addr show eth0| 
-|Set IP address|ip addr add 192.168.0.1 dev eth0| 
-|Delete IP address|ip addr del 192.168.0.193/24 dev wlan0| 
-|Show Ethernet status|ethtool eth0| 
-|Show Ethernet status|mii-tool eth0| 
-|Show Routing table|ip route show| 
-|Show the route packets will take|ip route get 192.168.0.1| 
-|Change default route|ip route add default via 192.168.0.2| 
-|Send echo request to test connection|ping host| 
-|Get who is information for the domain|whois domain| 
-|Get DNS information for the domain|dig domain| 
-|Get Reverse DNS information for the host|dig -x host| 
-|Lookup DNS IP address for the domain|host google.com| 
-|Lookup local IP address|hostname -i| 
-|Download a file|wget filename| 
-|Show all listening network ports|netstat -tulpn| 
-|Show network stats|ip -s link| 
-|Show network stats for an interface|ip -s -s link ls eth0| 
-|Show arp entries|ip neighbour| 
-|Monitor network messages|ip monitor all| 
-|Activate network interface|ip link set ppp0 up| 
-|Deactivate network interface|ip link set ppp0 down| 
-|Enable TCP Delayed Ack|ip route quickack| 
- 
----- 
- 
-===== Packages ===== 
- 
-| ^Command^ 
-|Install RPM based package|rpm -i pkgname.rpm| 
-|Remove package|rpm -e pgkname| 
-|Install from source|./configure\\ make\\ make install| 
- 
----- 
- 
-===== Process ===== 
- 
-| ^Command^ 
-|Display your currently active processes|ps| 
-|Find all processes related to "telnet"|<nowiki>ps aef|grep 'telnet'</nowiki>| 
-|Memory map of process|pmap| 
-|Display all running processes|top| 
-|Kill process with specific pid id|kill id| 
-|Kill all processes named xxx|kill xxx| 
-|Resumes suspended job without bringing them to the foreground|bg| 
-|Brings the most recent job to the foreground|fg| 
-|Bring job n to the foreground|fg n| 
- 
----- 
- 
-===== Search ===== 
- 
-| ^Command^ 
-|Search for a pattern in files|grep pattern files| 
-|Search recursively for pattern in directory|grep -r pattern directory| 
-|Find all instances of file|locate filename| 
-|Find filenames that start with xxx|find /home/peter -name 'xxx*'| 
-|Find filesnames larger than 10000k|find /home/peter -size +10000k| 
- 
- 
----- 
- 
-===== Users ===== 
- 
-| ^Command^ 
-|Display who is logged in|w| 
-|Show who is logged into the system|who| 
-|Display who you are logged in as|whoami| 
-|Display information on a user|finger user| 
-|Show the active user id with login and group|id| 
-|Show last logins on the system|last| 
-|Add a group|groupadd groupname| 
-|Add a user|adduser peter| 
-|Add a user|useradd -c "Peter Roux" - g admin -m peter # Add user peter| 
-|Delete a user|userdel peter| 
-|Modify user information|usermod peter| 
- 
- 
  
ubuntu/bash/commands.1574988050.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki