Editing
Basic Linux Commands
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Navigation & File Management === {| class="wikitable sortable" ! Command !! Description !! Usage |- | [[#ex-pwd|<code>pwd</code>]] || Print working directory || <code>pwd</code> |- | [[#ex-cd|<code>cd</code>]] || Change directory || <code>cd [DIRECTORY]</code> |- | [[#ex-ls|<code>ls</code>]] || List directory contents || <code>ls [OPTIONS] [FILE...]</code> |- | [[#ex-tree|<code>tree</code>]] || Recursively list directories as tree || <code>tree [DIRECTORY]</code> |- | [[#ex-mkdir|<code>mkdir</code>]] || Create directory || <code>mkdir [OPTIONS] DIRECTORY</code> |- | [[#ex-rmdir|<code>rmdir</code>]] || Remove empty directory || <code>rmdir DIRECTORY</code> |- | [[#ex-cp|<code>cp</code>]] || Copy files or directories || <code>cp SOURCE DEST</code> |- | [[#ex-mv|<code>mv</code>]] || Move or rename files/directories || <code>mv SOURCE DEST</code> |- | [[#ex-rm|<code>rm</code>]] || Delete files or directories || <code>rm [OPTIONS] FILE...</code> |- | [[#ex-touch|<code>touch</code>]] || Create empty file or update timestamp || <code>touch FILENAME</code> |- | [[#ex-ln|<code>ln</code>]] || Create hard or symbolic links || <code>ln [OPTIONS] TARGET LINK_NAME</code> |- | [[#ex-stat|<code>stat</code>]] || Display detailed file information || <code>stat FILE</code> |- | [[#ex-file|<code>file</code>]] || Detect file type || <code>file FILE</code> |- | [[#ex-basename|<code>basename</code>]] || Strip directory and suffix from filename || <code>basename PATH</code> |- | [[#ex-dirname|<code>dirname</code>]] || Extract directory part of file path || <code>dirname PATH</code> |- | [[#ex-find|<code>find</code>]] || Search for files and directories || <code>find [PATH] [OPTIONS] [EXPRESSION]</code> |- | [[#ex-locate|<code>locate</code>]] || Find files using database (faster than find) || <code>locate FILENAME</code> |- | [[#ex-chmod|<code>chmod</code>]] || Change file permissions || <code>chmod [OPTIONS] MODE FILE</code> |- | [[#ex-chown|<code>chown</code>]] || Change file ownership (user) || <code>chown [OPTIONS] USER FILE</code> |- | [[#ex-chgrp|<code>chgrp</code>]] || Change group ownership || <code>chgrp [OPTIONS] GROUP FILE</code> |- | [[#ex-umask|<code>umask</code>]] || Set default file permission mask || <code>umask [MASK]</code> |- | [[#ex-tar|<code>tar</code>]] || Archive files into tarball || <code>tar -czf ARCHIVE.tar.gz FILES</code> |- | [[#ex-gzip|<code>gzip</code>]] || Compress files using Gzip || <code>gzip FILE</code> |- | [[#ex-gunzip|<code>gunzip</code>]] || Decompress Gzip files || <code>gunzip FILE.gz</code> |- | [[#ex-zip|<code>zip</code>]] || Compress files into ZIP archive || <code>zip ARCHIVE.zip FILES</code> |- | [[#ex-unzip|<code>unzip</code>]] || Extract ZIP archive || <code>unzip ARCHIVE.zip</code> |- | [[#ex-dd|<code>dd</code>]] || Copy and convert data (low-level) || <code>dd if=SOURCE of=DEST bs=BLOCKSIZE</code> |- | [[#ex-mount|<code>mount</code>]] || Mount a filesystem || <code>mount [DEVICE] [MOUNTPOINT]</code> |- | [[#ex-umount|<code>umount</code>]] || Unmount a filesystem || <code>umount [MOUNTPOINT]</code> |- | [[#ex-namei|<code>namei</code>]] || Follow a file path, showing each component || <code>namei PATH</code> |- | [[#ex-readlink|<code>readlink</code>]] || Resolve symbolic link to actual path || <code>readlink FILE</code> |- | [[#ex-realpath|<code>realpath</code>]] || Print the resolved absolute file path || <code>realpath FILE</code> |- | [[#ex-mktemp|<code>mktemp</code>]] || Create a temporary file or directory || <code>mktemp [TEMPLATE]</code> |}
Summary:
Please note that all contributions to HackOps may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
HackOps:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Tools
What links here
Related changes
Special pages
Page information