Linux Commands

Linux Command Cheat Sheet

Hello everyone, here is a list of all the linux commands I can think of and can be helpful for your usage. Download Linux Command Cheat Sheet PDF Version here.

File Administration

  • ls [options] [arguments] : List the files in a particular directory or present directory if used without options or arguments
  • cd [options] directory: change the present directory
  • ln [options] original file link file : Create links b/w files or b/w directories
  • ln [options] original file : Create a link to the original file in the present directory
  • mkdir [options] directory : Make a directory
  • mv [options] source destination : Move and/or rename files and directories
  • pwd [option] : prints the current working directory
  • rm [options] file : Delete files or directories
  • rmdir [options] directory : Remove empty directories
  • tar [options] archivename [file(s)] : archive or extract files
  • chgrp [options] group files: Change group ownership of one or more files & directories
  • chmod [options]mode files: Change access permissions of one or more files & directories
  • chown[options] new owner files : Change the ownership of one or more files & directories
  • cp [options] source destination : Copy files and directories
  • find [start-point] [search-criteria] [search-term] : find files
  • gzip [options] filename : compress or expand files
  • cat [options] [filenames] [-] [filenames] : Display, combine or create new files.
  • cut [options] file : Cut out sections of each line of a file or files
  • diff [options] from-file to-file : Display the differences between two files
  • grep [options] pattern [file] : Search text and match patterns
  • head [options] filename(s) : List the first part of a specified file
  • less [options] filename : Display text files
  • more [options] filename : Display a text file
  • tail [options] filename(s) : List the last part of a specified file

Processes

  • crontab [-u user] [-l | -r | -e] : Schedule a task to run at a particular time or interval
  • kill [options] PID(s) : sends a signal to terminate a process or processes by PID
  • killall [options] command name : sends a signal to terminate a processes by name
  • ps [options] : displays a snapshot of the current processes
  • top [options] : display system and process information in real time

Network

  • ifconfig [arguments] interface [options] : Configure a network interface
  • ifconfig [arguments] [interface] : View network interface details
  • ip [options] object sub-command [parameters] : network configuration tool
  • netstat [options] : network connection monitoring tool
  • ping [options] remote server : checks the network connection to a remote server.
  • curl [options] [URL] : download or upload files to remote servers.
  • host [options] server : checks a computers IP address from its host-name or the reverse
  • scp[options][email protected]:directory/[email protected]:directory/filename : securely copy files between computers
  • sftp [options] [[email protected]] hostname [:directory] : interactively copy files between computers securely
  • ssh [options] [login name] server : securely access a remote computer.
  • traceroute [options] host-name : trace the route packets take to network host
  • wget [options] [URL] : download or upload files from the web non-interactivly.

Miscellaneous

  • apt-get install package-name : Install a package
  • apt-get remove package-name : Un-install a package
  • apt-get update : Update the database of available packages
  • apt-get upgrade : Upgrade the packages on the system
  • echo [options] [string(s)] : display text on the screen.
  • groupadd [options] group : add a group account
  • clear : clears the terminal screen.
  • man [options] command : display the reference manual for a command.
  • modprobe [options] modulename : Load or remove a Linux kernel module
  • passwd [options] username : change the user password
  • shutdown [options] [time] [message] : shut down or restart a system.
  • su [options] [username] : switch to another user.
  • sudo [options] command : Execute a command as the superuser
  • usermod [options] username : Modify a users account configuration
  • useradd [options] username : Add a user account
  • who [options] : report the users logged onto the system.
  • whoami [options] : report the current user.

File Systems

  • fdisk [options] [device] : manipulate partition tables.
  • mkfs [options] device : format a partition with a file system
  • mount [options] type device directory : Mount storage onto the file system
  • umount [options] device and/or directory : Unmount storage from the file system

System Information

  • date [options] +format : display or set the date / time
  • du [options] file : display the amount space used in files and directories
  • free [options] : displays information about free and used memory on the system
  • df [options] file : display the amount of free space on filesystems.

About the author

Avatar

Talha Saif Malik

I’m a computer scientist currently pursuing my Masters in Computer Science from COMSATS Institute of Information Technology Islamabad which is No.1 ranked IT University in Pakistan. I have done research in multiple domains and I’m well aware of WHATs and HOWs of research. My aim is to contribute in the research world as much as possible and change the world.