[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

[Linux] What do “~”, “$”, and “#” mean on the command line? [For beginners]

Hello, I'm inusuki from the System Solutions Department, and I'm an omnivorous otaku who loves games and anime.

This time, for beginners, I will write down the symbols that are often seen on the Linux CLI (command line interface).

Related terms & commands collection

term explanation
directory In Windows, this is a container for storing files.

You can create new files and directories within a directory.

Hierarchical structure It refers to the structure of directories within directories, directories within those directories, etc.

Also, because it branches like a tree, it is also called a tree structure.

root directory This is the topmost directory in a hierarchical structure.

The root is written as (/).

home directory This is the base directory for logged in users.

Users are basically free to create files and directories within that directory.

For example, when you create the dog user, the default home directory is /home/dog.

current directory Also called the current directory or working directory.

This refers to the directory where the logged-in user is currently located.

Absolute path (full path) Refers to the route (path) from the root directory to the destination.
relative path Refers to the route (path) from the current directory to the destination.

 

command explanation
cd change directory It is an abbreviation of

As the name suggests, it is used to move directories.

pwd print working directory It is an abbreviation of

Displays the absolute path from the root directory to the current directory.

What do the symbols on the Linux command line mean?

It's this kind of guy.

I will explain each one.

[dog@hostname ~]$

[root@hostname ~]#

「~」

The home directory of the logged-in user is abbreviated as "~".

If the dog user's current directory is the user's own home directory (/home/dog), it will be displayed as "~" instead of /home/dog.

Let's check using the pwd command.

[dog@hostname ~]$

[dog@hostname ~]$ pwd /home/dog

Move to /var/log for comparison.

[dog@hostname ~]$ cd /var/log [dog@hostname log]$

The end of hostname is now “log” instead of “~” (Yutane!)

This is because the current directory has changed to /var/log by moving the directory using the cd command.

Therefore, the pwd command results in the following output:

[dog@hostname log]$ pwd /var/log

「$」

"$" in Linux has various meanings and uses.

The "$" at the end of the CLI indicates that you are operating the command line as a general user.

[dog@hostname ~]$

「#」

The "#" at the end of the CLI indicates that you are operating the command line as an administrator user (root).

There was a time when I used to call this a hashtag. #Bedtime engineer

[root@hostname ~]#

Difference between administrator user and general user

The main difference is the level of authority that can be used.

The administrator user has all privileges by default, but the initial general user only has limited privileges.

Although you can grant privileges to general users with administrator privileges, we recommend granting the minimum privileges that suit your purpose.

This is one of the principles of privilege management and is called the principle of least privilege

 

In addition to user-level permissions, Linux also allows you to set operational permissions for individual files and directories.

I will not explain it here, but if you are interested, please search for Linux permissions

 

Thank you for viewing.

If you found this article helpful , please give it a like!
20
Loading...
20 votes, average: 1.00 / 120
12,779
X facebook Hatena Bookmark pocket
[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

The person who wrote this article

About the author

inusuki

Joined Beyond as a new graduate in April 2021.
Maybe it's because I have a problem with my output, but sometimes I say strange things.