File System
| Command | Description |
|---|---|
ls [dir] | List files with colored output, attributes, and sizes |
cd [dir] | Change directory (cd - for previous, cd for home) |
pwd | Print working directory |
mkdir [-cd] dir | Create directory (-cd to enter it immediately) |
touch [-d/-t] file | Create file or update timestamp |
rm [-r/-f] path | Remove file or directory; use rm -i dir for an interactive tree selector |
mv src dst | Move or rename file/directory |
cp [-r] src dst | Copy file or directory |
ln [-s] target link | Create hard or symbolic link |
stat file | Display file metadata |
chmod +/-r file | Toggle file attributes (r/h/s) |
unblock [-a|—attributes-only] path | Clear delete-blocking attributes and terminate locking processes; use -a to preserve processes |
find [pattern] [path…] | Recursive filename search (fd-style) |
du [-sh] [dir] | Disk usage of files/directories |
df | Show disk space of mounted drives |
mktemp [-d] | Create temporary file or directory |
basename path [suffix] | Strip directory and optional suffix |
dirname path | Strip last component from path |
ls
On Windows, ls is a builtin that shows file attributes, sizes, timestamps, and color-coded names by file type. On other platforms it falls through to the system ls.
> ls
d----- - Jan 15 09:44 src/
d----- - Jan 10 11:20 tests/
-a-r-- 2.5K Jan 15 14:23 Program.cs
-a-r-- 1.8K Jan 12 10:05 README.mdfind
find uses fd-style syntax: the first argument is a filename pattern, followed by
optional search directories. With no arguments it lists the current directory
recursively. Patterns are regular expressions, with case-insensitive matching
unless the pattern contains an uppercase character. Hidden entries and files
matched by .gitignore (in Git repositories), .ignore, and .fdignore are
skipped by default. Repository .git/info/exclude rules are also respected.
> find -e cs . src
src/Parser.cs
src/Lexer.cs
src/Interpreter.cs
> find -g "*.json" -t f
config.json
package.json
> find readme
README.mdUse -g for glob patterns, -F for literal text, -i or -s to override case
matching, and -t f|d|l to filter by file, directory, or symbolic link. Repeat
-e to match multiple extensions. -H includes hidden entries, -I disables
ignore rules, and -HI or -u includes both. -p matches the full absolute path,
-a prints absolute paths, -d limits depth, and -E excludes a glob. Quote
patterns containing shell metacharacters. Symbolic-link directories are listed
without traversal. Searches return all matches and print nothing when there are
no matches. Run find --help for supported options.