pctechguide.com

  • Home
  • Guides
  • Tutorials
  • Articles
  • Reviews
  • Glossary
  • Contact

Linux Commands for Navigating and Viewing Directories

Linux has hundreds of commands available, but to get around the system, view and edit text files we only need a handful. We’ll take a look here at the basic commands that are essential in setting up the dedicated server (download a free copy of Linux to test drive it).

Notice the convention of the $ sign in the examples given. This means that you are logged in to your Linux server and at the command prompt. From this point, simply type in the command and press enter. Anything in square brackets represents an instance that you’ll substitute with an appropriate value – so for instance [username] will be substituted with your username.

Linux Commands: Navigating

$ pwd

Use this command to find out where you are in the directory structure. When you log on to Linux, your starting directory is always your home directory, so you’ll be in /home/[your username] as any other user than root, or /root if you’re logged in as root. But, this can be useful if you ever lose track!

$ cd [directory]

A workhorse command, this is used to change the current directory. The directory named can be relative to the current directory, or absolute. To move relatively, using .. will move you up one level, or typing a directory name will move you into a subdirectory of the current. So, for example, if you’re in the directory /home/[username] and want to move to the directory /etc, you can do it in a couple of ways. If you type:

$ cd ..

You’ll be moved up one directory, so you’ll now be in the /home directory. Repeat the command, and you’ll be in the root (/) directory. Then, type:

$ cd etc

Now, you’ll be in the /etc directory. However, this is a bit cumbersome, but absolute addressing can achieve the same move in one step by simply preceding the address with a forward slash /. When you do this, the directory typed will be treated as relative to the root directory. So, from the example above, to move from /home/[username] directly to the /etc folder, enter:

$cd /etc

This will move the current directory to the /etc directory in one step. To move back, use:

$ cd /home/[username]

You can also use the following with cd:

$ cd ../../

Moves up two directories, and you can extend this as far back as required.

$ cd –

Moves to the previous working directory.

$ cd

Using cd without an argument moves the working directory straight to the user’s home directory. (Note: the cd command is synonymous with the chdir command.)

$ ls

This is the list command, so that you can view the contents of a directory including all files and subdirectories. If you don’t specify a directory then the current directory is assumed, but you can give an argument to a relative or absolute location.

$ ls /home/[username]

In this case the directory specified has its contents listed. The directory reference can be absolute or relative.

  • Advantage to Shared Web Hosting
  • Shared Hosting Issues – Shared Bandwidth and Server Resources
  • The Ins and Outs of Dedicated Web Hosting
  • When To Move To A Dedicated Server
  • Choosing a Dedicated Server for your Website
  • Managing and Operating a Dedicated Server Over the Internet Using Online Control Panels
  • Accessing the Linux Operating System on Dedicated Servers with PuTTY or SSH
  • How to Create a Secure Password
  • Using Sudo for Super User Access to Root Privileges in Linux
  • The Linux Directory Structure
  • Linux Commands for Navigating and Viewing Directories
  • Creating, Moving, Renaming and Copying Files and Directories in Linux
  • Find, View and Delete Files and Directories Using Linux Commands
  • Using vi to Edit Text Files on A Linux Dedicated Server

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

Filed Under: Moving from Shared to Dedicated Web Hosting Tagged With: list directory contents, navigating Linux, view directories in Linux, view directory contents in Linux

Latest Articles

P2P Networking

By early 2000 a revolution was underway in an entirely new form of peer-to-peer computing. Sparked by the phenomenal success of a number of highly publicised applications, P2P computing - as it is commonly referred to - heralded a new computing … [Read More...]

Office 2016 Is All About Teamwork

Microsoft Office 2016 is now available and it offers a range of new features you will find useful. It has tweaked some of the features to make them better, but it has been designed to help make your use of the application as productive as possible. There has been a big emphasis on collaboration in … [Read More...]

Remove Qone8.com Browser Hijacker

Qone8.com looks like a harmless search engine that will help you find useful information like Yahoo, Google or Bing. The search engine is owned Taiwan Shui Mu Chih Ching Technology Limited. However, it is a browser hijacker designed to supplant your home page with their search engine. It can do this … [Read More...]

2021 PC Hardware Releases to Bolster Your Gaming

If you are a PC gamer, then chances are you are looking to upgrade your kit over the coming year. However, a lot of money can go into building the … [Read More...]

New Transfer Feature in Dropbox Enable Sharing files with Third Parties

Dropbox has been a popular P2P sharing platform for many years. They don't announce new features as often as other applications, since they have a … [Read More...]

Ransomware Operators Find Data Theft Profitable

How valuable is your data? That’s not a question that organizations or individuals have to ask themselves all that often. You might know the market … [Read More...]

Engineers Encounter the Quantum Challenge with Computers Running a Hundred Million Times Faster

Quantum computers have been a subject of discussion for many years. They have probably been something that philosophers and technology pundits have … [Read More...]

Transferring Image Files from Your Cell Phone Without Cables or Email

You don't have a cable available to transfer the photos from your cell phone to your computer? You don't feel comfortable sending them through your … [Read More...]

Why Drupal Accessibility is Vital for Your Website

Drupal may not be as popular as WordPress, but it is still used in over 1 million websites. The Internet might be more conducive to our needs if more … [Read More...]

Guides

  • Computer Communications
  • Mobile Computing
  • PC Components
  • PC Data Storage
  • PC Input-Output
  • PC Multimedia
  • Processors (CPUs)

Recent Posts

Routers

Routing achieved commercial popularity in the mid-1980s - at a time when large-scale internetworking began to replace the … [Read More...]

Disk Keeper 2017 Pro Premier Reviews

PROS: Disk Keeper 16 Pro Premier Review for servers and high performance personal computers. CONS: The results of the Disk Keeper 16 Pro Premier … [Read More...]

Graphic Card Display Port – History

Announced in May 2006, the new DisplayPort standard was developed by a VESA Task Group comprised of leading companies in the display … [Read More...]

[footer_backtotop]

Copyright © 2021 About | Privacy | Contact Information | Wrtie For Us | Disclaimer | Copyright License | Authors