Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the command for linux to enter the directory

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to write linux into the directory command, has a certain reference value, interested friends can refer to, I hope you read this article after a great harvest, the following let Xiaobian with everyone to understand.

Linux is a free-to-use and freely distributed UNIX-like operating system, is a POSIX-based multi-user, multitasking, multi-threaded and multi-CPU operating system, using Linux to run major Unix tools, applications and network protocols.

Linux directory entry command is "cd", the role of the command is to switch to the specified directory, syntax format is "cd [dirName]". The parameter "dirName" indicates the target directory to be switched, which can be an absolute path or a relative path; if the directory name is omitted, it is converted to the user's home directory.

This tutorial will operate on Red Hat Enterprise Linux 6.1, Dell G3 computers.

The linux directory entry command is "cd."

Linux cd command can be said to be the most basic command statement in Linux, other command statements to operate, are based on the use of cd command.

Therefore, to learn Linux common commands, we must first learn the use of cd command skills.

1. Command format:

cd [dirName]

dirName: Target directory to switch.

2. Command function:

Switch current directory to dirName

The dirName notation can be absolute or relative. If the directory name is omitted, it is changed to the user's home directory (i.e., the directory where login was first located).

Also,~ means home directory. It is the current location of the directory,.. It represents the directory one level above the current directory location.

3. Command Usage

① When no parameters are added, switch to user home directory by default

② Connect absolute path or relative path, switch to corresponding directory

③ Connect special symbols and enter the corresponding indication directory

~ Enter the user home directory;

- Return to the directory you were in before entering this directory;

.. Return to the parent directory;

../.. Return to the upper two levels of directories;

!$ Use the arguments from the previous command as cd arguments.

4. Command example

Example 1: Switch to user home directory

[root@lianxi tmp]# cd[root@lianxi ~]#

Example 2: Absolute path to other directories

[root@lianxi ~]# cd /tmp/TEST/[root@lianxi TEST]#

Example 3: Relative path to other directories

[root@lianxi TEST]# cd ../ 1d/[root@lianxi 1d]#

Example 4:~ Enter user home directory

[root@lianxi 1d]# cd ~[root@lianxi ~]#

Example 5: Return to the directory you were in before entering this directory

[root@lianxi ~]# cd -/tmp/1d[root@lianxi 1d]#

Example 6: Return to parent directory

[root@lianxi 1d]# cd .. [root@lianxi tmp]#

Example 7: Using the arguments from the previous command as cd arguments

[root@lianxi tmp]# cd !$ cd .. [root@lianxi /]#Thank you for reading this article carefully. I hope that Xiaobian's shared "How to write the command of linux entering the directory" will help everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report