What is Linux and Directory in Linux?
Linux is an open-source operating system, its license is open for all to install it in your computer without any restriction. Today Linux is very popular for personal computers and data centres. Linux also provides a command-line facility that makes it very powerful we can do anything with Linux commands. Nowadays Linux has more than 1K flavours like (Ubuntu, Mint, and Fedora etc). The memory management of Linux is well organized with directories.
A directory is a folder or location where you can store your data in a proper way on your system. Different operating systems use different techniques for arranging directories. Such as Linux, UNIX is using hierarchical file system and trees.
How to change the Directory in Linux
In Linux we can change the directory in two ways:
- Using Command Line
- Using the Graphical User Interface
Using Command Line
In Linux operating system we have a lot of commands, every command has its own purpose or module. In the sense of directory first command is ‘ls ’. ‘ls’ command is very useful. It gives us all directories of files that are in the present directory. Now we will discuss different overviews of “ cd “ command.
[ me@linuxbox bin ]$ ls
“ cd ” command is very basic and useful command in Linux. We can change the directory or folder using “ cd ” using a command-line shell. First of all open the terminal ( Ctrl + Alt + T ). After opening the terminal you can check the current location using “ pwd ”.
A simple example of “ pwd ” is given below:
[ me@linuxbox bin ]$ pwd
“ cd ” command
[ ]$ cd [ directory ]
cd command examples with different parameters
if you want to change the home directory simple version is:
Alternative for changing the home directory:
$ cd ~
If you want to change the root directory:
$ cd /
If you want to change the present directory:
$ cd . .
If you want to Change subdirectory Documents:
$ cd Documents
Change to subdirectory Documents/Books:
$ cd Documents/Books
Change the absolute path /home/user/Desktop:
$ cd /home/user/Desktop
If the folder name consists of white space then “ cd “ command is : [ My data ]
$ cd My\ Data
$ cd ‘ My Data ‘
$ cd ‘ My Data ‘
How To Change Directory in Linux using sudo
“ sudo “ is an important command is a Linux operating system. It is very helpful for installing packages and change the directory or root. For example for root directory:
$ sudo su
[ enter the password]
Now you are in the root directory.
Above we discuss the “ cd ” command with a different aspect. Linus operating system also provides complete documentation of each command. For more information about the “ cd ” command:
$ cd –help
$ help cd
What is CD command in Linux?
How do I change my directory?
How do I change directories in terminal?
How do you move files in terminal?
In the Terminal app on your Mac, use the mv command to move files or folders from one location to another on the same computer. The mv command moves the file or folder from its old location and puts it in the new location.
How do you go up a directory in terminal?
How do I view a directory in Linux?
Which command will take you back to the home directory?
How do I list all directories in Linux?
How do I list all directories in terminal?
How do I list drives in Linux?
How do I find file details in Linux?
- find . – name thisfile.txt. If you need to know how to find a file in Linux called thisfile.
- find /home -name *.jpg. Look for all . jpg files in the /home and directories below it.
- find . – type f -empty. Look for an empty file inside the current directory.
- find /home -user randomperson-mtime 6 -iname “.db”
What is a directory in Linux?
How do I find file details?
How do I print file details in Linux?
Is command in Linux?
Ads by Google