Linux Tip | 10 Useful Linux Commands

แชร์
ฝัง

ความคิดเห็น • 430

  • @absdell5381
    @absdell5381 4 ปีที่แล้ว +10

    I am a beginner in learning Linux and other computer stuff. At first, I thought "why somebody is taking 34 minutes to tell about just 10 commands of Linux?" But it is really informative. Each minute of video is worth concentrating.

  • @RudyBleeker
    @RudyBleeker 8 ปีที่แล้ว +49

    As Joe explains, when you use the 'touch' command without any options it will set the time of the file you give as an argument to the current time. But it's good to note that you can use 'touch' to set the time of a file to anything you want with the -d option. This option will even understand a bit of natural language, for example "touch -d yesterday file" will set the time of "file" 24 hours in the past.

  • @nakternal
    @nakternal 8 ปีที่แล้ว +306

    Just subscribed. Finally someone who can explain Linux without putting me to sleep or pissing me off with goofy nerd trying to be cool humor or lack of.

    • @EzeeLinux
      @EzeeLinux  8 ปีที่แล้ว +20

      +nakternal Thanks. That's what I'm trying to do :)

    • @asdfkjhlk34
      @asdfkjhlk34 7 ปีที่แล้ว +4

      Agree

    • @EzeeLinux
      @EzeeLinux  7 ปีที่แล้ว +5

      :)

    • @AndrewPayne
      @AndrewPayne 6 ปีที่แล้ว +1

      Totally agree

    • @TheUtuber999
      @TheUtuber999 6 ปีที่แล้ว +16

      nakternal
      If you're using Linux you're already a nerd - might as well wear the label proudly.

  • @mohittheanand
    @mohittheanand 7 ปีที่แล้ว +137

    for clearing instead of "clear", just use ctrl+L

    • @EzeeLinux
      @EzeeLinux  7 ปีที่แล้ว +45

      That doesn't work on every terminal and I was trying to keep this video very close to the basics as possible. :)

    • @cagedtigersteve
      @cagedtigersteve 5 ปีที่แล้ว +13

      clear will erase your scrollback so you may want to do ctrl+L instead to preserve your scrollback (same as clear -x)

    • @amparorod2000
      @amparorod2000 4 ปีที่แล้ว +5

      The clear command only clears commands from the screen.
      But if you use history -c, the c option means clear. this will clear everything you typed when you opened the terminal. But if you never use this command before and you think all the commands you have typed are gone by using the clear command then you are wrong. There is this file that keeps all the commands that you have used. This file is called .bash_histor. But that's when you exit the terminal. All the commands will save.

    • @Void_Dragon
      @Void_Dragon 4 ปีที่แล้ว +3

      I prefer "reset"

    • @jamienordmeyer4345
      @jamienordmeyer4345 3 ปีที่แล้ว

      Nice! I'm running WSL2 on Windows. Naturally, it works in my Linux environment, but it turns out that it works in PowerShell as well. But not cmd.

  • @xekis
    @xekis 7 ปีที่แล้ว +5

    You can also search inside of less with "/". "-i" will toggle case sensitivity (though if your pattern has caps it will still assume case sensitivity. "n" for next, "b" for back. Very useful for large text files.

  • @TesserId
    @TesserId 3 ปีที่แล้ว +4

    Being pedantic again, sorry: strictly speaking, `cd` is a shell command, not a system command, which is why it doesn't have it's own manpage. You can actually find it with `man bash`. But don't do that. Use Bash's `help cd` command, instead. Oh, and also you can `help help`. (Also as a scripter, I went ahead and downloaded the Bash documentation to my local hard drive so that I can study it in a browser.)

    • @shellgenius
      @shellgenius ปีที่แล้ว +1

      Man bash
      Info bash
      Whatis bash
      Help bash
      Which bash

  • @IrizarryBrandon
    @IrizarryBrandon 8 ปีที่แล้ว +9

    Great "Linux Level 2" video - once we've gotten past cd, mv, ls, rm, and so on, we now have some cool commands that make life easier for us. In particular, I didn't know you could use shutdown -h as a kind of reverse alarm clock. Also, I find blkid useful for detecting USB drives. Thanks!

  • @g.5214
    @g.5214 8 ปีที่แล้ว +106

    Great video.
    I just want to add a thing:
    'cat' (abbreviation of concatenate) is actually used to concatenate (merge) two or more files.
    For example: cat file1.txt file2.txt file3.txt file_n.txt
    We can also redirect the output to, for instance, a file, like this:
    cat file1.txt file2.txt file3.txt > file_1_2_3.txt
    file_1_2_3.txt will consist of the contents of file1.txt, file2.txt and file3.txt
    Again, great video. Keep em coming.

    • @ariannamullen5809
      @ariannamullen5809 7 ปีที่แล้ว

      sksmd

    • @TheUtuber999
      @TheUtuber999 6 ปีที่แล้ว

      Goran
      It *can* be used that way, but its typical use is to print the contents of a single file to standard output (ie. the terminal).

    • @marekrudnicki4645
      @marekrudnicki4645 5 ปีที่แล้ว +2

      cat is an abbreviation of catenate not concatenate.

    • @alexwells2231
      @alexwells2231 3 ปีที่แล้ว

      Also > overwrites the file >> appends to the file

  • @gimcrack555
    @gimcrack555 6 ปีที่แล้ว

    I click on random links about Linux. Just to learn something new, or keep me refresh on commands I already know. That touch timestamp, I really didn't know that one. And will keep that fresh in my mind. That command can come in handy at times. Really like this video. So thumbs up.

  • @rickgaine3476
    @rickgaine3476 6 ปีที่แล้ว

    I’m glad to see you becoming more for Milyer with the technical aspects of Lenix. Much better than just installing different distributions and playing with different desktops.

  • @davinonnenmacher7272
    @davinonnenmacher7272 4 ปีที่แล้ว +6

    "And you become yourself once again" - Joe Collins, 2016

  • @davidwayne9982
    @davidwayne9982 2 ปีที่แล้ว +1

    As much as I hate coding and boring letter stuff-- guess it's time I learned some of the basic commands at least.. and I wanted to learn from you-- YOU make more sense teaching things...and there's no wasted fluff!!!

  • @dharmang
    @dharmang 5 ปีที่แล้ว +56

    would like to add this command
    sudo !!
    this will add sudo to the previous command and execute it, if u forgot to add root permission

    • @LloydLynx
      @LloydLynx 4 ปีที่แล้ว +2

      That would have been useful earlier today... very, very useful...

  • @cornlow
    @cornlow 7 ปีที่แล้ว +1

    I really like your teaching style and thank you so much for this video. You ROCK!

  • @NomadicDmitry
    @NomadicDmitry 4 ปีที่แล้ว

    The "touch" command is probably one of the primary ways why you would need to use a terminal in the first place. Great one!

  • @momashi69
    @momashi69 5 ปีที่แล้ว +12

    Instead of doing:
    cat file.txt | less
    you can do:
    less file.txt
    Thanks for the which tip, been using linux cli for over ten years and I didn't know this.

    • @xrafter
      @xrafter 3 ปีที่แล้ว

      Some commands needs you to do that

  • @MindoverMatrix2012
    @MindoverMatrix2012 7 ปีที่แล้ว +1

    Thanks! I'm learning your great knowledge and information, much appreciated.

  • @FeelingShred
    @FeelingShred 6 ปีที่แล้ว +1

    My 3 most useful at the moment:
    1) sudo sysctl -w vm.drop_caches=3 Reclaims free memory, avoid hang ups
    2) chmod +x /path/path/filename Makes a file executable (only local disk)
    3) sudo apt clean Clean apt cache

  • @gizzmoguy.
    @gizzmoguy. 8 ปีที่แล้ว +1

    These are the kind of videos that make me like Linux more and more each thanks for the video keep the good work

  • @sandysamuelofficial
    @sandysamuelofficial 3 ปีที่แล้ว +1

    Your video is very clear and well explained, thank you!

  • @gregorius62
    @gregorius62 7 ปีที่แล้ว +15

    There is no man page for cd because cd is part of the shell and is documented in the bash or other shell man page.

  • @MyVitros
    @MyVitros 5 ปีที่แล้ว

    Great video sir. I love Linux and have been using it since I was 16! I’m 27 now.

  • @carsonfball4
    @carsonfball4 5 ปีที่แล้ว

    In addition to these, I find top (which you briefly mentioned), kill, ps, and fg very useful. If you make a sequel video to this, I would suggest those as possible commands.

  • @mindright9771
    @mindright9771 5 ปีที่แล้ว

    Very good tutorial! I'm a long time Linux user and just wanted to check out your lessons. I will definitely recommend you to some of my students who are looking to learn about Linux commands. Aloha!

  • @andresho3618
    @andresho3618 6 ปีที่แล้ว

    Great for beginners like me. THANKS.

  • @williamjames9466
    @williamjames9466 5 ปีที่แล้ว +2

    Humour and genuineness holds my attention making the subject interesting and the video attention grabbing.

  • @phgeekstuff163
    @phgeekstuff163 8 ปีที่แล้ว

    Thank you Joe! Awesome tips!

  • @AlarusOne
    @AlarusOne 8 ปีที่แล้ว +1

    Awesome! I learned some new things today. Thanks. :)

  • @hpottstock
    @hpottstock 8 ปีที่แล้ว +1

    Thanks very much, Joe!

  • @georgeunknown2833
    @georgeunknown2833 8 ปีที่แล้ว

    Thanks a lot! Didn't know about "sudo -s" and "su user_name")... very useful commands!

  • @joedarvish70
    @joedarvish70 8 ปีที่แล้ว

    Thank you Joe. Keep up the good work. I hope you will publish more videos.

  • @CustomNameHere
    @CustomNameHere 8 ปีที่แล้ว +22

    I know this is being picky, but sda1, sda2, sdb1, sdb2, etc are PARTITIONS, not drives. sda1 is partition 1 on physical drive sda, and sdb2 is a partition on physdical drive sdb. I think it's important to use the correct terminology, especially for the audience you're trying to reach.
    I enjoy your videos, though. Keep up the great work !! :-)

    • @geodude9537
      @geodude9537 5 ปีที่แล้ว +2

      good point but he probably considered that common knowledge but we seem to forget there are complete newbies in the crowd

    • @firstspar
      @firstspar 5 ปีที่แล้ว +1

      Am new to Linux but a power/pro user in Windows. This comment was helpful.

  • @johnmal5975
    @johnmal5975 8 ปีที่แล้ว

    Thanks Joe very helpful!

  • @bennanas5516
    @bennanas5516 3 ปีที่แล้ว

    Great commentary, refreshing to hear as it is.

  • @briianhebert
    @briianhebert 7 ปีที่แล้ว +1

    Thanks for the great info!

  • @motoryzen
    @motoryzen 4 ปีที่แล้ว +1

    9:40 onwards= a headache saver for me. Thanks Joe

  • @elaynebarall7908
    @elaynebarall7908 5 ปีที่แล้ว

    Awesome commands as a new linux user... Thanks :)

  • @uniquechannelnames
    @uniquechannelnames 2 ปีที่แล้ว

    Just a little thing with the whole 'less' & 'more' scrolling thing. You can also set buttons to scroll either a half-page or a full page. ex: my half page is 'Shift + Down', scroll full page down 'Shift + Alt + Down'.
    So if I want to be scrolling half pages I just push shift then the desired direction. For full-page scrolling, do shift+alt then up or down for faster scrolling works great for me!

  • @dallase1
    @dallase1 5 ปีที่แล้ว

    I've had to use Ctrl Alt F4 a few times with MATE and would either do a Ctrl Alt Del or a shutdown command or reboot command.

  • @15lastone
    @15lastone 3 ปีที่แล้ว

    Thanks a lot really appreciate it, outstanding tutorial. One question I am using centoOS however I forgot my root password how can I reset it please, Thanks

  • @rickcontreras59
    @rickcontreras59 6 ปีที่แล้ว

    Helpful and very useful . Thanks Joe:)

  • @acejinwoo
    @acejinwoo 5 ปีที่แล้ว

    Very gud. Presently i am working to take my Linux knowledge to the next level so hopefully this time next year i too will be capable of making videos like this!

  • @SupremeNerd
    @SupremeNerd 4 ปีที่แล้ว +1

    you just earned a new sub. thanks for the info. (new Linux Mint user here)

  • @ArturKorobeynyk
    @ArturKorobeynyk 6 ปีที่แล้ว +1

    "Greetings and salutations"... I loved Might and Magic 6 too back in the days.

    • @EzeeLinux
      @EzeeLinux  6 ปีที่แล้ว

      It comes from when I was in school for radio... One of my teachers used to say that on the air. :)

  • @visheshpandita2787
    @visheshpandita2787 6 ปีที่แล้ว

    thanks for the knowledge!

  • @Dracon600
    @Dracon600 4 ปีที่แล้ว

    Thanks Joe, great video!

  • @vertigo6982
    @vertigo6982 5 ปีที่แล้ว +3

    Top 2 commands I suggest first to learn. #1 ' man intro ' #2 ' vimtutor '. If you use those to commands, and read everything contained in those commands, then you wont need to ask for help... for a long while.

  • @derekr54
    @derekr54 4 ปีที่แล้ว

    Very useful info thanks.

  • @mac6562
    @mac6562 7 ปีที่แล้ว +1

    awesome lesson

  • @carlpotter5539
    @carlpotter5539 7 ปีที่แล้ว

    Right-on Joe. Thanks

  • @ashrasmun1
    @ashrasmun1 6 ปีที่แล้ว

    I love that color scheme :)

  • @TheFlyguy31
    @TheFlyguy31 7 ปีที่แล้ว

    Thank you so much

  • @kevin34ct
    @kevin34ct 4 ปีที่แล้ว

    One command I find odd that isn't installed is traceroute (I know there is a package you can install). That along with the ping tool are very much needed to find a fault in a connection to a server. It can tell where the "break" is. It's helped me on Windows systems to find out that a local server was down. (Corporate server in another location). The fix was to force a reroute to a backup server. The reason it wasn't automatic was because the other server was 3000 miles away and didn't have everything that was needed. It was better to see it down so that it could be fixed quickly.

  • @asmaao908
    @asmaao908 7 ปีที่แล้ว +2

    soooo sooooo useful thanks a lot man I have an exam tomorrow . before I listened to this vidio I have zero idea about this freaking commands 😹😸 but now I'm a professional in 34min 😎💪 isn't it looks so great.

  • @theblackcatvieweraccount5402
    @theblackcatvieweraccount5402 4 ปีที่แล้ว +2

    "Shutdown -t 2" is useful for updating before bed. It'll finish the update and shutdown. For large updates I recommend "Shutdown -t 5" or 10 depending on the size of the update.

    • @gutoguto0873
      @gutoguto0873 ปีที่แล้ว

      Can’t you queue a command once the update is done?

  • @slonbeskonechen8310
    @slonbeskonechen8310 3 ปีที่แล้ว

    Thank You!

  • @Svetlio0989
    @Svetlio0989 6 ปีที่แล้ว

    great video,thanks a lot

  • @sonaminsan891
    @sonaminsan891 2 ปีที่แล้ว

    can u plz tell me that for linux which software i should for more practise

  • @alejandrojerez1492
    @alejandrojerez1492 3 ปีที่แล้ว

    The touch command is awesome. Go Linux!

  • @mwgary
    @mwgary 6 ปีที่แล้ว +1

    What about kill -9 (pid). That usually does does the trick. Failing that, xkill works wonders too.

  • @chromaticvisionstudio5489
    @chromaticvisionstudio5489 5 ปีที่แล้ว

    The Ten Commandments great video

  • @elektron2kim666
    @elektron2kim666 5 ปีที่แล้ว

    With the terminal in live boot I was able to remove a couple of files in my Pop-os install where I accidentally filled up the place with virtual disks of several GB and stopped the system with 0 bytes of free space. The startup worked after that. 7-8 GB of free space was required to show me a login. It's complicated to make oneself root/admin in Linux and give permission to be all over the place, but it worked and was funny to try and solve something like that. I think most terminal commands are well explained on the internet now.

  • @pseudonym033
    @pseudonym033 6 ปีที่แล้ว

    You are totally awesome, thank you Sir

  • @lifewithglee
    @lifewithglee 2 ปีที่แล้ว

    The ctrl alt F4 real terminal has been a saver for me although on a serious hang the TTY has been slow to process the login before I'm able to type "reboot." I only learned recently that ctrl alt F4 followed by ctrl alt del cuts out the authentication and its wait to give a clean shutdown/reboot

  • @cbrash9
    @cbrash9 8 ปีที่แล้ว +1

    Great Video Joe!!!!

  • @AyoubWissam
    @AyoubWissam 7 ปีที่แล้ว

    Thank you!

  • @easylinux8077
    @easylinux8077 4 ปีที่แล้ว

    Thanks for share!!

  • @orlandoc1714
    @orlandoc1714 4 ปีที่แล้ว

    thanks ,great video!

  • @sweetberries4611
    @sweetberries4611 5 ปีที่แล้ว

    touch command is truly useful, use it very often

  • @GifCoDigital
    @GifCoDigital 7 ปีที่แล้ว

    what do you use touch for that you cant just do by creating a new file and launching Vim all at once? IE: vi newFile

  • @HebaruSan
    @HebaruSan 7 ปีที่แล้ว +1

    "killall -HUP" (using the hang up signal instead of terminate) can give the program a chance to clean up, depending on how it's written.

    • @HebaruSan
      @HebaruSan 7 ปีที่แล้ว

      "mkdir -p" is great for ensuring that a path exists in a script, because if any of the parent directories are missing it'll create them for you as well.

  • @clav7711
    @clav7711 6 ปีที่แล้ว +1

    🙏🏻🙏🏻🙏🏻 I ear a book page !!! Oh my thanks a lot to explains that for us :) thanks thanks thanks

  • @rickcontreras59
    @rickcontreras59 6 ปีที่แล้ว

    Thank you Joe

  • @izabelak2562
    @izabelak2562 6 ปีที่แล้ว

    This youtube channel is the best

  • @scottb4029
    @scottb4029 2 ปีที่แล้ว

    I love the entomology of sayings. I have always wondered where the saying " more than one way to skin a cat " came from. Seems brutal, or is it just me? And does anyone else visualize the cat as still being alive? Maybe that is why I see it as brutal. Good stuff. Your bash playlist is the best on the web. Thanks a bunch.

  • @chriscarton4728
    @chriscarton4728 4 ปีที่แล้ว

    Love the way you talk.

  • @horizon42q
    @horizon42q 3 ปีที่แล้ว

    Very cool, excellent tutorial

  • @joetheman74
    @joetheman74 4 ปีที่แล้ว

    As for "which" command, I didn't know that one but I use "whereis" This command will not just tell you where the launch file is but will tell you where all the files related to the program are. It will often give multiple directories for libraries and other related files.

  • @rrook88
    @rrook88 7 ปีที่แล้ว

    nice vid. a lot new unix players wnet trough some of these things.

  • @themadhack3r431
    @themadhack3r431 5 ปีที่แล้ว +5

    165 haters saw this video 😂 Been a power user for many many years while these videos are aimed at new users I always learn or remember something I forgot. 165 haters 165 dislikes. I don't get it, Joe is very clear on his videos even a noob can get it witch is awesome! We need this MS and Apple are too nosey and downright intrusive on our data. More people need to use linux or bsd. Joe is doing community service here. No matter what the video I always leave a like.

    • @tubegor
      @tubegor 5 ปีที่แล้ว +2

      I also can not understand, how someone can dislike valuable help.

  • @phatamgiang8148
    @phatamgiang8148 7 ปีที่แล้ว

    Hi Joe,
    I have a simple problem, if it's in Windows, it wouldn't be a problem.
    I use Linux Mint 18.1 and this is the scenerio:
    Nautilus told me I have an internal drive name ABC and a USB drive named DEF. I would like to copy file from drive ABC to drive DEF, how would I issue the command in Terminal???
    Please help me! I am a Linux neubie.
    Thanks a lot, Joe.

  • @wildmanjeff42
    @wildmanjeff42 5 ปีที่แล้ว +1

    thanks for the videos. have learned a lot from your channel. If I could just find my perfect distro now :) like debian neptune and mint (I am still newbie-but learning it. )

  • @cyberp0et
    @cyberp0et 4 ปีที่แล้ว +4

    This reminds me of MS-DOS command prompt.
    I need to pracice more of these on Linux.

  • @TesserId
    @TesserId 3 ปีที่แล้ว

    My favorite use of touch is to match timestamps with other files: touch -r otherfile.txt
    And, there are reasons to get pedantic about the three different kinds of time stamps at the more advanced levels: ctime, mtime, and atime.

  • @frgging
    @frgging 8 ปีที่แล้ว +3

    Some alternatives of some commands in this video for productivity
    killall -> xkill
    ls -l -> la (in some distroes)
    clear -> Ctrl + L
    ctrl + alt +f7 back to GUI from tty

    • @sranstankovic233
      @sranstankovic233 4 ปีที่แล้ว

      Also for ls -l if you don't have it in your distro you can always edit ~/.bashrc file and add alias like so :
      alias la="ls -l"

    • @JakeSmith-fz9fp
      @JakeSmith-fz9fp 4 ปีที่แล้ว

      @@sranstankovic233 it should be
      alias la="ls -l --almost-all"

  • @sergioropo3019
    @sergioropo3019 6 ปีที่แล้ว

    thanks Sir.

  • @bevintx5440
    @bevintx5440 5 ปีที่แล้ว

    You don't have to "cat" a file to the "more" command on Linux/UNIX:
    more [options] [file_name]
    That was a requirement for the DOS "more" command.
    It is often useful to pipe the output from another command to less/more.

  • @rv-ollie
    @rv-ollie 6 ปีที่แล้ว +1

    Well, if you like the cat command, you might have a need for 'tac' as well. Try it. I've only used it once or twice.

  • @xheralt
    @xheralt 8 ปีที่แล้ว

    One thing I do with timed shutdowns is initiate a long download (say, a new Linux iso from somewhere) before going to sleep, look at the expected completion time, add a little for fudge factor, and tell the machine to 'shutdown -h' plus that amount of time. I also like +0 as faster typing than "now".

    • @Thorpe
      @Thorpe 8 ปีที่แล้ว

      I do that also on torrents. So it gets some seed time also on the distro iso and if it didn't finish, my download would just resume when I go back into the application.

  • @supahfly_uk
    @supahfly_uk 7 ปีที่แล้ว

    Hey Joe what do you think is best Linux mint or Ubuntu, I used to use mint as main os for a while, I felt like there was a lack of support and help for newbies and people where not very friendly in forums etc so i went back to win 7. I find your videos very helpful I'm itching to try Linux again.

    • @EzeeLinux
      @EzeeLinux  7 ปีที่แล้ว

      Try Ubuntu MATE. That's the easiest Linux to get started with and the support is awesome. :) ubuntu-mate.org/

  • @washingtonradio
    @washingtonradio 8 ปีที่แล้ว

    Good list

  • @freddychampagne4467
    @freddychampagne4467 6 ปีที่แล้ว +3

    It's late to tell you, but man is only for 'transient' commands.
    cd is an internal command inside bash (the shell).
    Help for internal commands of the shell is availlable with -> help
    so for your 'cd' command you would type -> help cd, and voila: there is the description of the command cd including all options ;)
    Additional info: cd without any 'arguments' puts you in your home directory, so it's not needed to type cd ~. cd on it's own is enough for going home ;)

  • @LinuxLuddite
    @LinuxLuddite 5 ปีที่แล้ว

    I think you can scroll cat output by 'ctrl+shift+alt+ up/down arrow ' or something

  • @metalarms98
    @metalarms98 5 ปีที่แล้ว

    Can you touch -R if you want to touch all files in a repository?

  • @bobsmurda119
    @bobsmurda119 3 ปีที่แล้ว

    Great video man.. very informative :) new sub

  • @mikey3266
    @mikey3266 7 ปีที่แล้ว

    Run cURL and pings as the server you're pinging might have turned pings off.

  • @cnicolas
    @cnicolas 8 ปีที่แล้ว

    Hello, may I ask which DE and theme are you using? I really like it :) - Thanks

    • @EzeeLinux
      @EzeeLinux  8 ปีที่แล้ว

      +Charbel Nicolas Linux Mint XFCE.

  • @davilathegreat
    @davilathegreat 6 ปีที่แล้ว +1

    Man, Puppy Linux is weird. One thing it does is opens a browser when you use the "man" command. I'm always root, unless I choose to be "Spot" (it says somewhere why, but I'll have to read up on that again). This is all so cool, though. Two months into playing around with Linux! I'm only mad at myself for not playing with it years ago.

  • @davidbooker2893
    @davidbooker2893 6 ปีที่แล้ว

    Thanks

  • @monday6740
    @monday6740 5 ปีที่แล้ว

    9:50 The WHICH command relies on the PATH variable, it totally ignores other copies of the same executable file on your computer, if not specified in PATH. Actually, nobody says that the paths in your PATH variable actually exist. The main reason to use WHICH is when you have multiple copies of a same-named executable spread out over different structures (path). But, also having those paths in the PATH variable. The order determines which one is used.