Note: To learn more about how to check and change permissions, refer to our Linux File Permission Tutorial. Mount a device: mount SSH LoginĬonnect to host as user: ssh connect to host via SSH default port 22: ssh hostĬonnect to host using a particular port: ssh -p to host via telnet default port 23: telnet host Show disk usage of the directory you are currently in: du -shĭisplay target mount point for all filesystem: findmnt See disk usage for all files and directory: du -ah
Show free inodes on mounted filesystems: df -iĭisplay disk partitions, sizes, and types with the command: fdisk -l See free and used space on mounted systems: df -h You can use the df and du commands to check disk space in Linux. Show information about a particular user: finger Disk Usage Show current calendar (month and day): cal Query and change the system clock with: timedatectl Show the IP address of the system: hostname -i System Informationĭisplay how long the system has been running, including load average: uptime Note: If you want to learn more about shell jobs, how to terminate jobs or keep them running after you log off, check out our article on how to use disown command. List files opened by running processes: lsof List and resume stopped jobs in the background: bgīring the most recently suspended job to the foreground: fgīring a particular job to the foreground: fg Terminate all processes labelled “proc”: killall Terminate a process under a specific name: pkill Terminate a Linux process under a given ID: kill Show processes in a tree-like diagram: pstreeĭisplay a memory usage map of processes: pmap
Install software from source code: tar zxvf
Install a package using the APT package manager: apt-get install Install a package using the DNF package manager: dnf install Install a package using the YUM package manager: yum install Show package information and summary: yum info List all installed packages with yum: yum list installedįind a package by a related keyword: yum search Note: If you want to learn more about users and groups, take a look at our article on how to add a user to a group in Linux. Temporarily elevate user privileges to superuser or root using the sudo command: sudo Show which users are logged in and their activity: wĪdd a new group by typing: groupadd Īdd a user to a group: usermod -aG Synchronize the contents of a directory with a backup directory using the rsync command: rsync -a Usersĭisplay who is currently logged into the system with the who command: who gz extension: gzip File TransferĬopy a file to a server directory securely: scp Ĭhange location to a specified directory: cd /chosen/directory File CompressionĪrchive an existing file: tar cf Įxtract an archived file: tar xf Ĭreate a gzip compressed tar file by running: tar czf Ĭompress a file with the. Move up one level in the directory tree structure: cd. Note: Want to read more about file creation? Check out an article about how to create a file in Linux using the command line. Show the number of words, lines, and bytes in a file: wc Show the contents of a file: more Īppend file contents to another file: cat > ĭisplay the first 10 lines of a file with: head Rename to with the command: mv Ĭreate a symbolic link to a file: ln -s /path/to/ Recursively copy the contents of one file to a second file: cp -r Recursively remove a directory without requiring confirmation: rm -rf Ĭopy the contents of one file to another file: cp Show directory you are currently working in: pwdĬreate a new directory: mkdir List all files ( shows hidden files): ls -a See files larger than a specified size in a folder: find -size File Commands List names that begin with a specified character in a specified location by using the find command: find -name Recursively search for a pattern in a directory: grep -r įind all files and directories related to a particular name: locate Search for a specific pattern in a file with grep: grep Test for unreadable blocks on device/disk: badblocks -s /dev/ Searching Show hardware information from the BIOS: dmidecodeĭisplay disk data information: hdparm -i /dev/diskĬonduct a read-speed test on device/disk: hdparm -tT /dev/ Show PCI devices in a tree-like diagram: lspci -tvĭisplay USB devices in a tree-like diagram: lsusb -tv See information about block devices: lsblk List hardware configuration information: lshw Hardware Informationĭisplay free and used memory with: free -h The commands found in the downloadable cheat sheet are listed below.