Prev. Page >> Linux Command Tricks

ls command

Display the content of the current directory

-a: include hidden files and directories
-l: long listing, which includes filenames, permissions, owners, size, links and date information
-lh: human readable format
-F: List Files and Directories with ‘/’ Character at the end
-r: display files and directories in reverse order
-R: Recursively list Sub-Directories
-ltr: shows the latest modification file or directory date
-lS: Sort Files by File Size in Descending order i.e., big size files first
-i: Display Inode number of File or Directory
–version: Shows version of ls command
–help: Show Help Page
-n: display UID and GID of files and directories

ls command and its Aliases

alias ls="ls -l"

mkdir command

To create a new directory with the specified name

mkdir <directory-name>

-m777: create a directory and set permissions at the same time
-p: create a directory and parent directory, if it doesn't exist
-v: verbose output for getting the confirmation of the directory creation

more command

more <filename>

displays specified file's content one screen at a time

-num lines: Sets the number of lines that make up a screenful. The lines must be an integer.
-d: With this option, more will prompt the user with the message “[Press space to continue, ‘q' to quit.]” and display “[Press ‘h' for instructions.]” when an illegal key is pressed, instead of ringing a bell.
-l: more usually treats ^L (CONTROL-L, the form feed) as a special character, and will pause after any line that contains it. The -l option will prevent this behavior.
-f: Causes more to count logical, rather than screen lines (i.e., long lines are not wrapped).
-p: Do not scroll. Instead, clear the whole screen and then display the text. This option is switched on automatically if the more executable is named page.
-c: Do not scroll. Instead, paint each screen from the top, clearing the remainder of each line as it is displayed.
-s: Squeeze multiple blank lines into one blank line.
-u: Do not display underlines.
+/string: Search for the string, and advance to the first line containing string when the file is displayed.
+num: Start displaying text at line number num.

Prev. >> Linux Command Tricks

Next >>Linux Command Tricks II