How to change directory in Linux using cd command

I recently made the switch and started using Debian Linux. How do I change directory in Linux using the cd command? How can I change a directory or folder in Linux?

Introduction – You need to use the cd command to move from your present directory to another directory. You must have execute or search permission in the specified directory. This page shows basic examples of how to change directory on Linux using the cd command.

How to change directory in Linux

The procedure changes a directory or folder in Linux as follows:

  1. Let us change to your home directory in Linux, run: cd
  2. If you want to change to the /etc/security/ directory on Linux, execute: cd /etc/security/
  3. Want to go up one level of the directory tree in Linux? Try: cd ..

Let us see some examples and usage in details.

Changes the current directory in Linux

Let us change the current working directory to the home (login) directory in Linux, run:
To print the current working directory, use the pwd command:
Next change to an arbitrary directory named /etc/ufw/, type:
cd /etc/ufw

At this stage, you may want to list the directory contents. Hence, try the ls command:
ls -l

Say you need to go down one level of the directory tree (say you want to change to the applications.d), run:
cd applications.d
ls -l

How do I go back to my home folder or directory in Linux?

Simply type any one of the following command:
cd ~
cd $HOME

Changing to another directory in Linux using the cd command

How to change a folder in Linux

Get list of directories only in the current directory using the following:
ls -d */
Once you know the directory names, change it as per your needs:
cd linux

To move back to a parent directory directory, type:
cd ..
Verify it:

Linux change directory using the cd command

Linux change directory and symbolic links

One can force symbolic links to be followed. The syntax is:
cd -L dir1
cd -L link2

To use the physical directory structure without following symbolic links:
cd -P link2

Force symbolic links with the -L option and he physical directory structure with the -P option


This page explained the cd command that allows you to change directories. For more info type the following command at the terminal:
cd --help
help cd

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 4 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • Marlena Dec 12, 2013 @ 13:43

    Quick question – Is the cd command depends upon my shell on Apple mac os X?

    • 🐧 Vivek Gite Jan 1, 2014 @ 17:29

      Yes, the cd is an internal command. Check your shell documentation. Regardless of operating system, the syntax remains same across Linux, *BSD, macOS and Unix-like system
      cd dir
      cd ..
      cd /path/to/dir/

    • Mr. Bill Nov 22, 2017 @ 3:02

      Girl, learn to read the man pages. You can thank me later.
      type -a cd
      command cd
      man bash
      man ksh
      man csh
      help command
      help type

  • SOY FAN Apr 13, 2016 @ 16:12

    That is all we need:
    help cd
    You see full info:


Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @