ls


"/home/yossef/notes/personal/linux/ls.md"

path: personal/linux/ls.md

- **fileName**: ls
- **Created on**: 2025-07-15 16:20:24

ls: list directory contents

description: list directory content (files and folder)

args:
-a, --all: don't ignore any files i mean(hidden files .)
-A: don't list home directory . And preview directory ..
-author: print the author for the files and more information
-b: don't include any space for the first char in line
-B, --ignore-backups: do not list implied entries ending with ~
-l: mean long format output this mean showing more information about files
-t: mean format the output based on their modification
-c: also sort by the time but with timestamp

Important

  1. With ls -lt, files are sorted based on their modification time.
  2. With ls -ltc, files are also sorted based on their timestamp.

-d, --directory: showing info about the current working directory
best way to use with -lt

[yossef@archlinux ~]$ ls -ltd
drwx------ 1 yossef yossef 1790 Jul 15 16:37 .

--file-type: showing a / for directory likewise, except do not append '*'

[yossef@archlinux ~]$ ls --file-type
 2025-05-07_01-52.png   Games/            node_modules/       problems/

-g: like -l (long format) but not showing owner for file or dir .
-G, --no-group: in a long listing, don't print group names (don't show groups).
-h, --human-readable: with -l and -s, print sizes like 1K 234M 2G etc.
--si: likewise, but use powers of 1000 not 1024
-H, --dereference-command-line: follow symbolic links listed on the command line
ls --hide='*.log': This will hide all log files from the listing.
--hyperlink: for showing a hyperlink based on some option .
-n, --numeric-uid-gid: like -l, but list numeric user and group IDs

(showing the user id and group id instead of name)

-i: Print the index number of each file (inode number)
--ignore: ls -li /path/to/directory --ignore="*.tmp"

(this how to use ignore param)

-m: no spacing between files and directory at all
-N, --literal: print entry names without quoting
-o: like -l, but do not list group information
-p, --indicator-style=slash: append / indicator to directories
-Q, --quote-name enclose entry names in double quotes
-r, --reverse: reverse order while sorting
-R, --recursive: list subdirectories recursively
-s, --size: print the allocated size of each file, in blocks
-S: sort by file size, largest first
--time=WORD:
select which timestamp used to display or sort; access time (-u): atime,
access, use; meta‐ data change time (-c): ctime, status;
modified time (default): mtime, modification; birth
time: birth, creation;
with -l, WORD determines which time to show; with --sort=time, sort by WORD (newest first)

continue this shit

continue:[[]]
before:[[]]