Difference between revisions of "Useful Linux commands"
Jump to navigation
Jump to search
m |
(Starting fresh; added some file and directory management commands.) |
||
Line 1: | Line 1: | ||
− | + | The one-stop shop for all your Linux command needs. Most commands listed will work on our machines, though that can vary based on installed packages and/or operating systems. | |
− | + | == File and Directory Management == | |
− | + | === ls === | |
+ | Lists all files and directories | ||
+ | * <code>ls -a</code> - List all files, including hidden ones like .ssh, .bashrc, and so on. | ||
+ | * <code>ls -l</code> - Include extra file information like permissions, owner, groups, modified date, and more. | ||
+ | * <code>ls -s</code> - List size of files in blocks. | ||
+ | * <code>ls -S</code> - List by size, largest first. | ||
− | + | === cd === | |
− | + | Used to change the directory. | |
− | + | * <code>cd</code> - When no path is specified, you will move to the user's home directory. As root, you will move to <code>/root/</code>. As your user, you will move to <code>/eccs/home/<username>/</code>. | |
− | * | + | * <code>cd /path/to/file</code> - When changing directories, if you're not in the immediate parent directory, you need to specify the full path. For example, if my current working directory is <code>/etc</code>, I can <code>cd jupyterhub</code> since it's within <code>/etc</code>. However, if my current working directory is <code>/bin</code>, I would have to specify the full path for <code>/etc/jupyterhub</code>. |
− | |||
− | |||
− | |||
− | cd - | ||
− | |||
− | |||
− | * cd / | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 20:24, 22 March 2025
The one-stop shop for all your Linux command needs. Most commands listed will work on our machines, though that can vary based on installed packages and/or operating systems.
File and Directory Management
ls
Lists all files and directories
ls -a
- List all files, including hidden ones like .ssh, .bashrc, and so on.ls -l
- Include extra file information like permissions, owner, groups, modified date, and more.ls -s
- List size of files in blocks.ls -S
- List by size, largest first.
cd
Used to change the directory.
cd
- When no path is specified, you will move to the user's home directory. As root, you will move to/root/
. As your user, you will move to/eccs/home/<username>/
.cd /path/to/file
- When changing directories, if you're not in the immediate parent directory, you need to specify the full path. For example, if my current working directory is/etc
, I cancd jupyterhub
since it's within/etc
. However, if my current working directory is/bin
, I would have to specify the full path for/etc/jupyterhub
.