Skip to content
  • Linkedin
  • Youtube
  • Pinterest
  • Home
  • Privacy Policy
  • About
  • Contact
Programmingoneonone

Programmingoneonone

Programmingoneonone is a website that publishes daily tutorials, methods, guides, and articles on IT, Education, and technology.

  • Home
  • Human Values
  • DSA
  • IoT Tutorials
  • Interview Questions and Answers
  • Toggle search form
environment and path setting in linux

Environment and Path Setting in Linux

Posted on 3 June 2023 By YASH PAL No Comments on Environment and Path Setting in Linux

Environment and Path Setting in Linux – Bash shell is used for various purposes under Linux. How do you customize the shell environment variable under Linux operating systems?

You can use shell variables to store data, set configuration options, and customize the shell environment under Linux. The default shell is Bash under Linux and can be used for the following purposes:

  1. Configure the look and feel of the shell.
  2. Set up terminal settings depending on which terminal you’re using.
  3. Set the search path such as JAVA_HOME, and ORACLE HOME.
  4. Set environment variables as needed by programs.
  5. Run commands you want to run whenever you log in or out.
  6. Set up aliases and/or shell functions to automate tasks to save typing and time.
  7. Changing bash prompt.
  8. Setting shell options.

You can use the following commands to view and configure the environment.

Display Current Environment in Linux

To display the current environment, type the following command:

$ set

BASH =/bin/bash
BASH_ARGC = ()
BASH_ARGV = ()
BASH_LINENO = ()

Note – There are other values available in the environment depending on your system. we are not displaying the whole values here.

The $PATH defines the search path for commands. It is a colon-separated list of directories in which the shell looks for commands. The $PS1 defines your prompt settings. see the list of all commonly used shell variables for more information. you can display the value of a variable using the printf or echo command.

$ echo “$HOME”
OR
$ printf”%s\n” $HOME

Sample output

/home/ram

You can modify each environmental or system variable using the export command. Set the PATH environment variable to include the directory where you installed the bin directory with Perl and shell scripts:

export PATH = $ { PATH)/home/ram/bin
OR
export PATH=${PATH}:${HOME}/bin

Pathnames

Every file has a pathname, which is a trail from a directory through part of the directory hierarchy to an ordinary file or a directory. Within a pathname, a slash (/) to the right of a filename indicates that the file is a directory file. The file following the slash can be an ordinary file or a directory file. The simplest pathname is a simple filename, which points to a file in the working directory.

Absolute Pathnames

An absolute pathname starts with a slash (/), which represents the root directory. The slash is followed by the file’s name located in the root directory.

setting environment and path in linux

An absolute pathname continues, tracing a path through all intermediate directories, to the file identified by the pathname. String all the filenames in the path together, following each directory with a slash (/). This string of filenames is called an absolute pathname because it locates a file absolutely by tracing a path from the root directory to the file.

The part of a pathname following the final slash is called a simple filename, or basename. the above figure shows the absolute pathnames of directories and ordinary files in part of a filesystem hierarchy.

environment and path setting in linux

Relative Pathnames

A relative pathname traces a path from the working directory to a file. The pathname is relative to the working directory. Any pathname that does not begin with the root directory (represented by /) or a tilde (~) is a relative pathname. Like absolute pathnames, relative pathnames can trace a path through many directories. The simplest relative pathname is a simple filename, which identifies a file in the working directory.

Computer Science Tutorials, Linux Tags:computer science, Linux

Post navigation

Previous Post: Hard links and Symbolic links
Next Post: VI Editor in Linux

Related Tutorials

programming languages for machine learning and data science Top Programming Languages For Machine Learning Computer Science Tutorials
Introduction to Statistics for Data Science: Building a Solid Foundation Computer Science Tutorials
How to Become a Successful Data Engineer in the Data Science Field – Complete Guide Computer Science Tutorials
Is Python a good language for Machine Learning/AI? Computer Science Tutorials
basics of boolean algebra Its Operators, Laws, and Examples Basics of Boolean Algebra: Its Operators, Laws, and Examples Boolean Algebra
x winodws in linux X Windows system in Linux Computer Science Tutorials

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Pick your Subject

  • Internet of Things
  • Data Structures/Algorithms
  • Interview Preparation
  • Human Values
  • Java Interview Questions and Answers (2023)
    Thinking of becoming a Java developer? I must say it’s a good choice! Java is continuously named the most popular programming language. And the … Read more
  • Iot(Internet of things) in healthcare
    IoT in Healthcare
    IoMT (Internet of Medical Things) stands for devices that can collect and exchange data – either with users or other devices via the internet, … Read more
  • four stages of iot solution for industry
    IoT for Industry
    In this post, we are going to learn about use cases of IoT for Industry and four stages for providing IoT solutions. Machine Diagnosis … Read more
  • Iot for agricultural
    IoT in Agriculture
    IoT technology has realized smart wearables, connected devices, automated machines, and driverless cars. However, in agriculture, the IoT has brought the greatest impact. Amongst the challenges … Read more
  • Iot for logistics
    IoT in Logistics and Supply Chain
    IoT applications for smart logistics and supply chain systems:  Logistics Fleet Tracking  To track the locations of the vehicles in real time, the vehicle … Read more
  • Algorithms Tutorials
  • Basic Programming
  • Boolean Algebra
  • C Programming Tutorials
  • C++ Tutorials
  • Compiler Design Tutorials
  • Computer Networks Tutorials
  • Computer Organization Tutorials
  • Computer Science Tutorials
  • Data Structures Tutorials
  • DBMS Tutorials
  • Developer Guide
  • Digital Communication
  • Digital Logic Tutorials
  • Internet of Things Tutorials
  • Internet Tutorials
  • Interview questions answers
  • Java Tutorials
  • Javascript Tutorials
  • Linux
  • Machine Learning Tutorials
  • Operating Systems Tutorials
  • Programming Tutorials
  • Projects
  • Tips&Tricks
  • Tools
  • VBScript Tutorials
  • Java Interview Questions and Answers (2023)
    Thinking of becoming a Java developer? I must say it’s a good choice! Java is continuously named the most popular programming language. And the … Read more
  • Iot(Internet of things) in healthcare
    IoT in Healthcare
    IoMT (Internet of Medical Things) stands for devices that can collect and exchange data – either with users or other devices via the internet, … Read more
  • four stages of iot solution for industry
    IoT for Industry
    In this post, we are going to learn about use cases of IoT for Industry and four stages for providing IoT solutions. Machine Diagnosis … Read more
  • Iot for agricultural
    IoT in Agriculture
    IoT technology has realized smart wearables, connected devices, automated machines, and driverless cars. However, in agriculture, the IoT has brought the greatest impact. Amongst the challenges … Read more
  • Iot for logistics
    IoT in Logistics and Supply Chain
    IoT applications for smart logistics and supply chain systems:  Logistics Fleet Tracking  To track the locations of the vehicles in real time, the vehicle … Read more

Copyright © 2023 Programmingoneonone.

Powered by PressBook Blog WordPress theme