Command Basics - Windows: Changing Directories
Root Directory in Linux
- The main directory in Linux from which all others stem is called the root directory.
- The path to the root directory is denoted by a slash (/) or forward slash.
- Example of a path starting from the root directory:
/home/Cindy/desktop (similar to C:\Users\Cindy\desktop in Windows).
Listing Directory Contents (ls Command)
- The
ls (list directory contents) command is used to view the contents of a directory. - If no path is provided, it defaults to the current directory.
- Example:
ls / lists all directories under the root directory.
Important Directories Under Root
/bin: Stores essential binaries or programs (e.g., the ls command itself).- Similar to the
Program Files directory in Windows.
/etc: Stores important system configuration files./home: The personal directory for users, containing documents, pictures, etc.- Similar to the
Users directory in Windows.
/proc: Contains information about currently running processes./usr: Meant for user-installed software./var: Stores system logs and files that constantly change.
Command Flags
- Flags are used to specify additional options for a command.
- Usually specified using a hyphen (
-) followed by the flag option. - Every command has different flag options.
Getting Help with Commands
--help flag: Displays available options for a command.man command: Shows manual pages (man pages) for a command.
ls Command Flags
-l (long) flag: Shows detailed information about files and folders in a long list format.- Similar to the
Show Properties option in Windows. - Output Breakdown (from left to right):
- File permissions
- Number of links a file has
- File owner
- Group the file belongs to
- File size
- Timestamp of last modification
- File or directory name
-a (all) flag: Shows all files in the directory, including hidden files.- Hidden files/directories are prepended with a dot (
.). - Example:
.iamhidden
Combining Flags
- Flags can be appended together (e.g.,
ls -la / is the same as ls -l -a /). - The order of the flags does not matter.
Key Concepts
- Computer paths
- Linux file system navigation
- Getting help with commands