How does Linux know where to look for the commands that you type at the command-line? In this video you’ll learn how the $PATH variable works in Linux. Specifically, we’ll look at how this value is looked up in bash, and how you can modify it.
I’ll also introduce you to the `which` command, which you can use to check which filepath bash is using for a given name (executable).
To modify PATH for
-a single user (normal or root): /home/username/.bash_profile
-all users except root: /etc/profile
Full Linux Sysadmin Basics Playlist:
Check out my project-based Linux System Administration course (free sample videos):
Official Site:
Twitter:
Facebook:
Patreon:
Nguồn: https://ftlinuxcourse.com
Xem thêm bài viết khác: https://ftlinuxcourse.com/lap-trinh-linux
Xem thêm Bài Viết:
- Trải nghiệm mới hay ho với hướng dẫn cài Mac Os trên vmware
- Bật mí cách cài đặt ssl miễn phí lên Let’s Encrypt
- Tuyệt chiêu tạo usb boot kali linux đơn giản dành cho bạn
- Hướng dẫn chi tiết từ A – Z các bước cài đặt Python trên Windows 10
- Bật mí quy trình cài đặt Kali Linux trên Vmware đúng chuẩn và chi tiết
Very helpful!
what would be the effect of "export PATH=………" ? Am I adding a path to the existing list of paths? Or do I override all the previous directories? And why export? Thank you
Thank you for the explanation on this, I failed to fully grasp $PATH until your video.
Super useful, thank you!
Finally a Linux tutorial where I can actually understand the speaker ! Thank you for this!!! 😉
Don't see .bash_profile in Ubuntu 18.04 or /etc/profile
Thanks a lot. That was really helpful.
Is not usr "universal system resource" and not "user"?
This was a BRILLIANT tutorial, thank you so much for doing this! 😀
Valeu consagrado!
HI, in the end of your video i tried to open the .bash_profile files and they were different, and hard coding the path didn't work, maybe the structure got updated ?
Отличное видео и хороший русский акцент!
p.s. Из России с любовью
Nicely done!
love these videos
5:53 pidr
great dude
how to remove path
The game is Monkey Island? =]
you are sooo funny with that accent, really. I laughed
4:40 the evil
I tried the command subversion trick earlier in the video with both my virtual (Ubuntu) and my main (Centos 7.0) machines.
I changed the $PATH variable on the command line by placing /root in the front. When echo-ing $PATH, the /root directory does in fact appear first. Then, I created a script called clear that just echoes a short line. It didn't work; the screen simply cleared as normal. Then I tried changing the .bash_profile in my Centos 7.0 machine and did the same thing. The clear command just cleared the screen as usual.
What is happening?
There is no .bash_profile on my Ubuntu (virtual) machine. Are there any other ways to change the $PATH variable?
i didn't get anything about this . i need help
Very helpful. Thanks!!!!!
Thank you very much…
sir!!can u make a video on how doe sthe mkdir command work??what are the inode numbers for . and .. after mkdir completes??
There's no ~/.bash_profile in my ubuntu 18.04. But there is a ~/.profile
here it is:
*****@*******:~$ cat .profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
Reference to Deus Ex quote in the script ( https://youtu.be/rJMFxIbDe-g?list=PLtK75qxsQaMIlFCcFZpTBLnaCJ0I0uiaY&t=324 )
I understand that "sudo" is Super User Do [du], but I just can't abide it being pronounced like "sue-doo", rather than like "pseudo." It just sounds stupid.
But then I'm easily annoyed.
Very helpful .thanks
Thank you!
Apologies if this is a dumb question, but I'm new to learning all of this. In regards to prepending to a path, did you place sudo within the root directory prior to prepending the root directory?
I wanted to add to the PATH for all users, but when I looked in etc/profile there is no usage of PATH at all. Where could it be set instead?
Tip: Always use "su – root", never "su root". With 'su – root' you will get the environment variables of root, with "su root" you keep the environment variables of the current user. Or even more secure use "/sbin/su – root"
Thanks! Finally a video where someone speaks english, not bash!
I don't have a .bash_profile just a .profile , on Ubuntu 16.04 😀
been working with Linux servers for a long while now, never got to understand what PATH is for, thanks for your tutorial now i understand its importance!
Video is simply brilliant! Thanks !
Who is seeing "Hi my name is josh and blah blah " udemy add. I watch this every time !!!!!!!
bash_profile only works on bash. You better start using .pam_environment
While messing with linux and learning stuff, I've been running a set of automatic youtube downlaod scripts to archive interesting and useful channels that I'd like to have for the future. You made the cut, but this video broke the file management, haha. "du -h" on my archive drive makes this one split into 17 different files called:
everything you need to know about
everything you need to know about /usr
everything you need to know about /usr/local
everything you need to know about /usr/local/sbin:
everything you need to know about /usr/local/sbin:/usr
and this keeps going until
everything you need to know about /usr/local/sbun:/usr/local/bin:/usr/sbin:/usr/bin:sbin:/bin:/usr/local/games:/usr
At 7:41, 7:50, and 8:06 I swear I hear some sort of custom sound effects. Do you have something going on?