RapidYT

Ls command in Linux

ls command mostly usable command in Linux. ls command tells us all the presenting files in the directory.

By linux 3 min read

Ls command Provide Information About Files Which Present inside the directory. By default, Provide current directory Information in alphabetical order.

Syntax

ls [OPTION]... [FILE]...

output ls command info


Options

ls -a: Mean all Files Show Inside Terminal.

output all files

ls -A: Mean almost all File But Do not Show . And .. Files.

Output files all the hidden file

ls -l --author: this Command Work With -l Flag Or Option, and it prints out the author information of each file.

output file author information

ls -b: the ls command prints C-style escape characters in your terminal.

output c-style characters

ls --block-size=SIZE: This Flog Convert Your File With Different Size.Example Megabyte, kilobyte, and Other soo.

ls -c : this Flag Give You Output Recently modify files. This Option Never Be Work With -l Flag.

output recently modify files

ls --color[=WHEN] : Show Output With Colorize. The default can always be auto. if Stop This You Use never.

output some valid example in the color flag

ls -G : Print list Without Group Names.

output without group

ls -h or ls --human-readable : Print Output with -l and -s. Show File Sizes In CMD like 1K 234M 2G.

ls -i or ls --inode : print the index number of each file In Your Cmd.

output index number

ls -k or ls --kibibytes : this Flag Show You Block Size Of Each File. By default, Each Block Size is 1024-byte.-k Flag Working With -s Flag.

ls -l : Print long listing Information format Pattern Inside Your Cmd.

output long list

ls -m : m flag Show comma-separated list of entries Files.

output comma-separated file

ls -n or ls --numeric-uid-gid : Show you numeric user and group ids.

output user and group ids

ls -N : -N Flag print File names without comma-separated or quoting( , ).

output without comma separated

ls -o : Print Information Without List Group Information.

output without Group name

ls -p or ls --indicator-style=slash : append Slash / After Your directories Files Name.

Note: Indicate- style Work Same Or Note

--indicator-style arguments are:

output with slash

ls -Q or ls --quote-name : Show Your File Name With double-quotes.

output with double quotes

ls --quoting-style=escape : use this flag to Style you are quoting Inside Your Terminal

More arguments are

output with different style

ls -r or ls --reverse : Print reverse order Your Files (z to a)

output reverse order

ls -R or ls --recursive : print Your All Files With subdirectories Files.

ls -s or ls --size : Print Size of each file With blocks Form.

the output size of each file

ls -S : Sort by File Size, Largest First.

--sort=’none’ : Sort Your File, Base On Arguments Like time and size Read More Valid More Arguments are:

output file according to size

ls -t: Sort Your File Base On Modification Time and Newest Create First.

output file base on modification

ls -X: sort Your File Base On alphabetically.

output file on alphabetically

ls -1: Print list one file per line.

output list in one line

ls --help: display document About ls Command.

output help pages

ls --version: Print Ls Command Version.

output version

ls -man: Check Your Manual Page Use -man Command.

output manual pages