Skip to main content

Navigating The File System In Linux

In my opinion, the most important thing to learn as a newbie in the Linux system is navigating the file system. Files in Linux systems are organized in a hierarchical directory structure, that is, a tree-like pattern of directories or folders. The first directory is called the root directory and it contains files and subdirectories which contain even more files and directories.



Linux unlike Windows has a single file system tree regardless of how many storage devices or drives are attached or mounted to the computer. Storage devices are mounted at different points of the tree according to the inclination of the system administrator.

Windows on the other hand, has a separate file system for each storage device.

Current Working Directory 
To display the current working directory, we use the pwd command (print working directory).
By default, when we start a terminal session, our home directory is usually our current working directory. Each user account in a Linux system is given its own home directory and this is the only place where a regular user is allowed to write files.

Listing Directory Contents.
To list the files and directories in any directory, including the current working directory, we use the ls command. 

Changing the current working directory.
To change your current working directory, we use the cd command which is short for change directory.
To change this, type cd followed by the path name of the desired working directory. 
Pathname can be defined as the route taken to the the desired directory. They can be specified either as absolute or relative pathnames. 

Absolute pathnames
Also referred to as absolute path or full path.
It specifies the location of a file or directory from the root directory(/).
An absolute pathname begins with the root directory and follows the tree branch by branch to the desired directory or file. We'll use the example of a directory in your system where most of your system's programs are installed. The pathname is /usr/bin.

So we'll move into that directory using
cd /usr/bin



Relative Pathnames
Starts from the working directory. To do this, it uses the following special symbols to represent relative positions in the file system tree:
dot (.) - represents the working directory.
dot dot (..) - refers to the working directory's parent directory.

Helpful Shortcuts
cd  
Changes the working directory to your home directory.
cd -
Changes the working directory to the previous working directory.
cd -username
canges the working directory to the home directory of username. Example cd -eneri will change the directory to the home directory of user eneri.

Facts about Filenames
  • Filenames that begin with a period character (.) are hidden. This means ls will only list them when you type in ls -a.
  • Filenames and command are case sensitive. File12 is not the same as file 12.
  • Linux has no concept of  file extension. You may name files any way you like.
  • Limit punctuation characters to period(.) dash(-) and underscore(_). Do not embed spaces in filenames, instead use the punctuations aforementioned.
 
 

Comments

Popular posts from this blog

Fun Terminal Commands Every Linux User Should Try

Accessing Maps from the terminal with MapSCII Requirements Telnet installed Internet Connection Firewall is disabled You can do this on Linux, Unix, Mac OS X or Windows with an app like PuTTY or the Windows 10 Linux bash shell or any Os that supports telnet. Open terminal and write the command below. telnet mapscii.me Hit enter and you're ready to browse and enjoy MapSCII. Navigate using the keyboard or mouse. Use the following keys on your keyboard Arrow keys: up, down, right, left A to zoom in Z to zoom out C toggles ASCII mode on/off You can also click and drag and hold on the map with your cursor. If your connection dropped without a reason, reconnect with telnet -E mapscii.me and use only cursors, A and Z to navigate. The Mapscii project is open source and you can install it locally if you'd like. Check out their project here on GitHub . The Dancing ASCII Party Parrot Requirements Curl installed Internet

SQL for Data Analysis - Udacity

  Entity Relationship Diagrams An  entity relationship diagram  (ERD) is a common way to view data in a database. Below is the ERD for the database we will use from Parch & Posey. These diagrams help you visualize the data you are analyzing including: The names of the tables. The columns in each table. The way the tables work together. You can think of each of the boxes below as a spreadsheet. What to Notice In the Parch & Posey database there are five tables (essentially 5 spreadsheets): web_events accounts orders sales_reps region You can think of each of these tables as an individual spreadsheet. Then the columns in each spreadsheet are listed below the table name. For example, the  region  table has two columns:  id  and  name . Alternatively the  web_events  table has four columns. The "crow's foot" that connects the tables together shows us how the columns in one table relate to the columns in another table. In this first lesson, you will be learning the bas

(Easy)Getting Started With R - Gapminder Dataset Part 1(Free Tutorial)

This guide will get you started on the path to exploring and visualizing your own data with the R programming language. It introduces you to the tidyverse which is a collection of data science tools within R for transforming and visualizing data. This is not the only set of tools in R, but it's a powerful and popular approach for exploring data. At every step, you'll be analyzing a real dataset called gapminder. Gapminder tracks economic and social indicators like life expectancy and the GDP per capita of countries over time. The experience you gain on this example will help you in analyzing your own data. You'll learn to draw specific insights and communicate them through informative visualizations with the ggplot2 package.  The first code you'll write is to load two R packages, which is done by writing library(packagename). R packages are tools that aren't built into the language, but were created later by other programmers. Each of them provides tools