29 Linux Commands You Must Know

ls – List ls lists the contents (files and folders) of the current working directory. It’s the same as you opening a folder in file explorer to see its contents in GUI. mkdir – Make Directory mkdir makes (or creates) a new directory. It’s the same as you using the context menu’s ‘new/create directory’ option to create a new folder (or directory) using file explorer in GUI. pwd – Print Working Directory pwd prints the current working directory. cd – Change Directory cd sets the given folder (or directory) as the current working directory for the current running session of the terminal (or bash). It’s the same as you opening a directory to do some operations using file explorer in GUI. rmdir – Remove Directory rmdir removes (or deletes) the given directory. rm – Remove rm removes the given file or folder. You can use rm -r to delete folders recursively. cp – Copy cp copies the file or folder from one location to another location. You can use its cp -r option to copy folders recursively. mv – MoVe mv moves a file or folder from one location to another location. It can also act to rename the file or folder if the file or folder is in the current working directory but the file or folder has a new name. cat – concatenate and print files cat concatenates and prints files on the standard output (i.e., the monitor or computer’s screen). It’s the same as you viewing contents of text files using text viewer or editor in GUI. tail – print TAIL (from last) tail prints the last 10 lines (by default) of the given file on the standard output (i.e., the computer’s screen or monitor). You can use tail -n N to dictate the last N number of lines to print on the screen. less – print LESS less prints the given file page by page (or window by window). It’s useful and efficient for viewing large files containing lots of textual data that won’t fit on the screen. You can press Ctrl+F to go forward and Ctrl+B to go backward by one page. It’s the same as you viewing the contents of a text file in a text viewer or editor and reading the file page by page in GUI. grep grep "" searches for a given string in a given file. You can use grep -i "" to make a case-insensitive search and grep -r "" to search for the given string in all files recursively in the current working directory. Find This command searches for files matching specified criteria in the given location. You can use find -name its ‘-name’ option to make a case sensitive search and find -iname to make a case-insensitive search for files with the given file names. 1 find -iname tar This command creates, views and extracts tar archives. You can use tar -cvf to create,tar -tvf to view and tar -xvf to extract tar archives. gzip gzip creates and extracts gzip archives. You can use its gzip -d to extract gzip archives. unzip unzip unzips a given zip archive. You can use unzip -l to view the contents of the zip file without extracting it. It’s the same as you using an archive program to extract zip archives in GUI. help --help lists all the available commands in the terminal. You can use ‘-h’ or ‘–help’ (help has two hyphens here) option with any command to get help for that specific command. whatis – What is this command whatis shows a single-line description for the given command. man – Manual man shows the manual page for the given command. exit exit ends the current terminal (bash) session. It’s the same as you clicking on the close button in the title bar of any application to close that application in GUI. ping ping pings a remote host (server) by sending ping packets. It can be used to check for network connectivity or the status (up and running or otherwise) of a server. It’s the same as you pinging a host using the network manager in GUI. who – Who Is logged in who shows the list of currently logged in users. su – Switch User su switches to a different user. Super user (root) can switch to any other user in the terminal even without using their password. uname uname shows important information about your system such as kernel name, host name, kernel release number, processor type and various others. You can use uname -a to view all information. free – Free memory free shows information about the free, used, swap memory available (or currently free) in your system. You can use free -m to view memory in KBs and free –g to view memory in GBs. df – Disk space Free df shows information about the file system’s disk space usages – used and available storage space on your hard disk and other storage devices. You can use df -h to view the space usages in human readable form (i.e. memory in GBs). ps – ProcesseS ps displays information about the running processes of the system. Top – TOP processes top shows information about the top processes in the system (sorted by CPU usage by default). You can use top -u to view the top processes of a single user. It’s the same as you viewing the list of the most resource-hungry running processes using some task manager in GUI. shutdown shutdown shuts down your computer. You can use shutdown -r to restart your computer.

Comments

Popular posts from this blog

IT Terminology

200 Keyboard Shortcuts (Windows) to Boost Your Productivity

Things Everyone Should Know How To Do