Results 1 to 5 of 5

Thread: How does commands are executed in Linux wihtout any prefix or other command?

  1. #1
    Join Date
    Feb 2017
    Beans
    0

    Lightbulb How does commands are executed in Linux wihtout any prefix or other command?

    In linux everything is in the form of a file. So if you want to do anything you need to have a reference of the file where you want to perform a task
    Like in shell scripting if you want to execute a script you need to write 'sh myscript.sh' or './myscript'
    I am not sure but I think there must be some script or code written for each and every command in linux
    So if you want to run a command like "mkdir" you can directly write and execute without the reference of the directory or without a prefix cammand like 'sh' in shell script
    So can anyone please tell me how this actually works

  2. #2
    Join Date
    Apr 2011
    Location
    Mystletainn Kick!
    Beans
    13,615
    Distro
    Ubuntu

    Re: How does commands are executed in Linux wihtout any prefix or other command?

    Splat Double Splat Triple Splat
    Earn Your Keep
    Don't mind me, I'm only passing through.
    Once in a blue moon, I'm actually helpful
    .

  3. #3
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How does commands are executed in Linux wihtout any prefix or other command?

    Welcome to the forums.

    PATH environment variable. Almost every other OS (Windows/OSX/Unix/iOS/Android/ ..... MVS) uses this method too.

    There are many books that cover this. The Linux Command Line is a book which explains this and hundreds of other things about the way Linux really works. Free, no-hassle, download. There are also beginning Linux/Unix training classes for free at EdX and LinuxFoundation.

    And just to clarify ... everything is not "a file", there are "processes" too. Files and processes - that's the ticket.

  4. #4
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: How does commands are executed in Linux wihtout any prefix or other command?

    Any executable file, binary or shell script, which is sitting in one of the system $PATH directories, will work when the name is typed in terminal; you do not then have to give the full pathway to the executable file.

    You can see which are your $PATH directories with command
    Code:
    echo $PATH
    which in Ubuntu family OSs will be
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    plus /home/username/bin folder in your home if you have created it and have put any executables in that folder.
    Last edited by ajgreeny; February 8th, 2017 at 07:15 PM.

  5. #5
    Join Date
    Feb 2017
    Beans
    0

    Re: How does commands are executed in Linux wihtout any prefix or other command?

    Thanks for the help
    Very nice explaination 😁😁
    Got the answer of my query

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •