Followers

Linux- Directory commands

 


image image image image

Example:

Hostname:  hostname command is used to print the hostname of your system.
To change the hostname ( I am changing hostname to node1) follow the following steps.

  • sudo su
  • hostname node1
  • echo "node1" > /etc/hostname
  • bash
Every user has its home directory, run the following command to find the home directory of logged in user

echo $HOME

Environment Variables: These are the variables that are defined globally on the system or user level.

For example, PATH is an environment variable, and to print the value of the PATH variable run the below command.

echo $PATH

To find all the environment variables run env command

env 

How to Create an environment variable

export var_name=Value
export Name=Raman
env

How to remove the environment variable

unset var_name
unset Name

How to add a new path(/home/vagrant) to PATH variable

export PATH=/home/vagrant:$PATH


Experiment:- 

  • Find the value of the HOME env variable for the current user and root user.
  • Create a shell script file and provide 777 permission to the file and check the PATH variable value and move it to any of the folders like (/usr/local/bin) and check that you can execute this file from any location of your system.
  • Print all environment variables
  • Create an env variable MVN and set value as "maven home"
  • delete the MVN variable from the enviornment.

Create a directory test under /tmp directory

 mkdir /tmp/test

Create a directory unitTest under /tmp/test/typesoFTesting

   mkdir -p /tmp/test/typesoFTesting/unitTest

Check the current working directory

pwd

Change to unitTest directory and verify you are in unitTest directory

cd /tmp/test/typesoFTesting/unitTest
pwd

Change directory from unitTest to typesoFTesting directory

 cd ..

Go back to /home/ubuntu directory

cd /home/ubuntu
pwd

Remove directory unitTest

rmdir /tmp/test/typesoFTesting/unitTest 

COMMENTS

Name

Ansible,6,AWS,1,Azure DevOps,1,Containerization with docker,2,DevOps,2,Docker Quiz,1,Docker Swarm,1,DockerCompose,1,ELK,2,git,2,git quiz,1,Git Worksheet,1,ITIL,1,ITSM,1,Jira,3,Kubernetes,1,Kubernetes Quiz,5,SAST DAST Security Testing,1,SDLC Quiz,5,SonarQube,3,Splunk,2,vagrant kubernetes,1,Windows,1,YAML Basics,1,
ltr
static_page
DevOpsWorld: Linux- Directory commands
Linux- Directory commands
DevOpsWorld
https://www.devopsworld.co.in/p/linux-directory-commands.html
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/p/linux-directory-commands.html
true
5997357714110665304
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content