The following are the most commonly used command in Linux.
ls– list the files and directories in the folderls -aList all files and directories along with hidden filesls -lList all files and directories in long formatls -lhList all files and directories with size in human readable formatls -tSort by time (newest first)ls -tSort in reverse order (oldest first)ls -lrth– list the files and directories in the folder in long format and sorted reverse by time, and size in human readable formman commandTo see manual for a particular command (Eg:man ls)cat /path/to/filenameRead the filegrep -rni 'search string‘ Search for the string within all files in current directorygrep -rni '/path/to/filename.txt'Search for string in the particular filefile ./ -name '*string*'Search for the file namehistoryPrints the previously used commands
Shortcuts in terminal
Ctrl + R– Search previous commandsCtrl + W– Delete a wordCtrl + right arrow– Move the cursor by word right sideCtrl + right arrow– Move the cursor by word left sideUp arrow– Show the previously used command
PS: The above command and shortcuts are mostly used by me, this blog I wrote to keep note of the same for my personal use and might be useful for someone.
Leave a comment