Linux / UNIX: Command Not Found Error and Solution

Why I am getting the error Command not found? How do I fix this problem on Linux, macOS or Unix-like systems?

One of the most common questions asked by new Linux or Unix system users. When you get the error “Command not found,” it means that Linux or UNIX searched for command everywhere it knew to look and could not find a program by that name. Another cause is that you misspelled the command name (typo) or the sysadmin administrator does not install the command on your Linux/UNIX based system. To get rid of this error, try the following suggestions:

Make sure command was not misspelled

All Linux and UNIX commands are case sensitive, and you need to type the correct spelling of the command.

Make sure command is your path

PATH is an environment shell variable that shows the different directories that your shell will see in order to find commands. You can see the current search path with the following echo command/printf command:
$ echo "$PATH"
$ printf "%s\n" "$PATH"

Sample outputs:


Usually, all user commands are in /bin and /usr/bin or /usr/local/bin directories. All your programs are installed in these directories. When you type the clear command, you are running /usr/bin/clear. So if it is not in your PATH, try to add directories to your search path as follows (setup Linux or UNIX search path with following bash export command):
$ export PATH=$PATH:/bin:/usr/local/bin
You can also find out of the path using which command or whereis command or type command/command as follows:
$ which ls
$ which gcc
$ which date
$ which cal
$ whereis gcc
$ type -a gcc
gcc is /usr/bin/gcc
gcc is /bin/gcc
$ type -a time
Here is how it looks:

time is a shell keyword
time is /usr/bin/time
time is /bin/time

$ command -V time
time is a shell keyword

Typing full path

You can run a program using its full pathname. For instance, run ls as /bin/ls:

$ /bin/ls
$ /bin/date

Permission problem

Finally, sometimes you may not have permission to run the command. Remember, all Unix or Linux commands or scripts must have executable permission set. We can verify (view file permission) this using the ls command:
$ ls -l /bin/ls
$ ls -l ~/bin/toc

Outputs indicating my custom script called ~/bin/tochel has executable permission for user, group, and others:

-rwxrwxr-x 1 vivek vivek 132 Oct 19 00:31 /home/vivek/bin/toc

We can display file information and status easily by using the stat command:
$ stat /bin/ls
Command Not Found on Linux and Unix
macOS Unix desktop or Linux desktop file manager also displays file permission. Make sure you have executable permission:
Linux file permissions
Of course, we can use the chmod command to set executable permission:
$ chmod +x filename
$ chmod +x /path/to/filename
## sysadmin level permission needed for other users ##
$ sudo chmod +x /path/to/

Run the command as the root / superuser

Some commands need privileged access. Hence run it as follows:
sudo command
sudo /path/to/command
sudo -u userName command2

See “How do I become superuser on Ubuntu Linux using su/sudo?” and “How Can I Log In As root User?” for more info.

The curious case of missing command

If a typed Unix command is not in PATH and anywhere on the system means the command or app is not installed at all. Hence, the last option is to install a missing package.

You think your command is installed on Linux or Unix/macOS desktop. Still, you or the sysadmin/vendor didn’t install the Unix command to begin with. Here is an example when I type bashtop:
$ bashtop
And system will say:

bash: bashtop: command not found

In other words, bashtop may not be installed, and we need to install the same. For instance I can install bashtop using the operating system’s package manager:
$ snap install bashtop # snaps (apps) on Linux
$ sudo apt install bashtop # Debian Linux
$ sudo dnf install bashtop # Fedora Linux
$ sudo pacman -S bashtop # Arch Linux

Now we can run the command that was missing:
$ bashtop

bashtop running on Linux desktop

bashtop running on Linux desktop


Let’s assume the program you want to execute is called “cal,” and you get a “Command not found” error message from Unix or Linux system. First, type the following command to see if you get a pathname:
$ whereis cal
Sample outputs:

cal: /usr/bin/cal /usr/share/man/man1/cal.1.gz

If you do, you can invoke it using a full path name (e.g. /usr/bin/cal):
$ /usr/bin/cal
Sample outputs:

   September 2012
Su Mo Tu We Th Fr Sa
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29

Or you can add the path to your PATH variable in your shell start-up file $HOME/.cshrc (csh/tcsh) or $HOME/.bashrc (bash) file, then “source” the file:
$ vi $HOME/.bashrc
Add the path as follows:

export PATH

Save and close the file. Run the following source command:
$ source ~/.bashrc
$ echo "$PATH"
$ cal

Finally, you can use the following find command to search for cal command get a hit about its location.
$ find / -name cal -print
Another faster option is to use the locate command:
$ locate cal
Then, invoke it using a full path name or add it to your PATH variable in your shell startup file.


In short, look for the following to fix “bash: bashtop: command not found“:

  1. Make sure the shell PATH variable correctly set and verify your PATH environment variable.
  2. Verify that the file you want to execute or run exists on the Unix or Linux box.
  3. Some commands need to run as the superuser (root user). Typically we use sudo or su.
  4. Ensure the software package is installed for missing command, and you have permission to run the command.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 66 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
66 comments… add one
  • Lei Zhu Oct 2, 2006 @ 3:13

    Hi,I have a problem when I run the command under Cygwin.
    I type
    However,it shows:
    :command not found
    ‘/run.bash: line 6: Syntax error near unexpected token ‘

    ‘/run.bash: line 6: ‘function gplot’

    All this code was definitely right, that’s our teacher who give to us..
    So what’s the problem?
    Thank you

  • 🐧 nixCraft Oct 2, 2006 @ 7:02

    Line 6 has an error. Can you just copy and paste your source code here. Put in

    <code>your script code…</code>

    tags, so that I can help you further.

  • sanjay Aug 20, 2007 @ 19:17

    the command ‘setup’ is not working, it says command not found although there is a man page for that command…can u help me how to make it work or is there any alternate command for the above??

  • sandeep Sep 7, 2007 @ 5:51

    I have a bash script say “simulate”.
    When i type simulate on cmd prompt, it says
    command not found. but when i type
    ./simulate it works.
    What can be reason. i checked PATH, /bin is there.
    Which bash says /bin/bash.

  • 🐧 nixCraft Sep 7, 2007 @ 10:19


    Add your home directory to PATH
    export PATH=$PATH:/home/you

    • Hiroshi Nov 23, 2010 @ 5:04

      Thank you so much!

      I was having this same problem.

  • ranjani Nov 20, 2007 @ 8:43

    Hi configure command is not there in my bin folder. So this command is not executing. Pls help me that what i have to do to run this command?

  • CL23 Dec 23, 2007 @ 1:07

    If the $PATH variable is correct a fully qualified path works, try typing “rehash” at the command prompt to update the systems list of valid commands.

  • shan Aug 20, 2008 @ 18:04

    the man command is not working
    it gives comand not found error.

  • jathin sanghvi Nov 4, 2008 @ 13:05

    i get an error as ‘Command not found’ when i use zgrep. can any one help me on this. any command to grep through zip files(i need the filename as output)

  • zaid Dec 12, 2008 @ 8:15

    hi guys!

    i’m new to ns2..could someone please tell me why i keep having “command not found” error messages as follows. What should i doooo??? HELP

    zaid@ymax-hw-0006:~/Desktop/ns-allinone-2.32/ns-2.32$ testing.tcl
    /home/zaid/Desktop/ns-allinone-2.32/ns-2.32/testing.tcl: line 4: namtrace-all: command not found
    /home/zaid/Desktop/ns-allinone-2.32/ns-2.32/testing.tcl: line 6: proc: command not found
    /home/zaid/Desktop/ns-allinone-2.32/ns-2.32/testing.tcl: line 7: global: command not found
    /home/zaid/Desktop/ns-allinone-2.32/ns-2.32/testing.tcl: line 8: flush-trace: command not found
    /home/zaid/Desktop/ns-allinone-2.32/ns-2.32/testing.tcl: line 9: close: command not found
    zaid@ymax-hw-0006:~/Desktop/ns-allinone-2.32/ns-2.32$ Cannot connect to existing nam instance. Starting a new one…

    nam: Unable to open the file “out.nam.nam”

  • Jonas Aug 19, 2009 @ 16:16

    Help me
    I have a samba server configuration , and when I will start it, it show me this post of error
    /bin/bash: smbd: command not found
    And I don´t know what i have to do for fix it

  • swarnima Oct 10, 2009 @ 11:21

    when i used the echo command
    its showing command not found
    and i dnt know how to fix
    plz help me

  • Didi Oct 11, 2009 @ 9:21

    my Linux Fedora 6 was hacked by some one who change the rights of root and give himself all right
    now i can enter with root but when i want to execute command always get this message ‘commang not found’
    what can i do to take back my root right please?

  • Zeeshan Nov 16, 2009 @ 21:31

    This is very very easy and useful. *** V V Good ***

  • swapna Nov 18, 2009 @ 9:43


    I want to execute sas program through unix script.
    I tried to execute simple program through script.below is the script:
    cd //SASDATA/cz/cp151/Macros

    However, I could not execute it.I get following message:
    sh sas: not found

    Please guide me .

  • RAJU A Feb 10, 2010 @ 6:04

    Dear friendz,
    When i open terminal in ubuntu linx,it showing me::::; desktop:command not found

  • gejuboy Apr 18, 2010 @ 21:05

    I have installed successfull the ns2 .Tclscripts can’t be compiled,morover,uptil now(because i have just tried very simple & small programes) “puts” command is not working.It is saying- command not found.I have installed cygwin in g drive.I am opening the prompt from desktop shortkut & entering the directory by-
    $ cd c:
    $ cd cygwin
    $ set a “5”
    $ puts a
    bash: puts: command not found
    also i was trying to find whereis “puts command” i found the location but i dont know how to handle the problem .
    puts: usr/share/man/man3/puts.3.gz

    Thanks in advance……….

  • Sameer Apr 19, 2010 @ 12:12

    Hi Vivek,

    I want to know the path for command “export”, command “set”
    when I am doing
    [root@test usr]# /usr/bin/which export
    /usr/bin/which: no export in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin)

    can you please help me on this?


  • Justin May 6, 2010 @ 2:13

    I ran into a “make: arm_v5t_le-gcc: command not found” with “make” facility while I was doing compile a program.
    I ran this compiling with arm_v5t_le-gcc full path, I got the same error.
    I checked the $PATH, and the the arm_v5t_le-gcc is in there.
    I checked with “locate”, and the arm_v5t_le-gcc is there.
    I checked with “which”, and the arm_v5t_le-gcc is there.
    I checked the permission, and the arm_v5t_le-gcc is 755.
    What else may cause this “command not found” error? Any guys can help me?
    Thank you very much!

    • What was the solution? Jul 28, 2016 @ 6:57

      For the newbies if possible

  • gherson May 24, 2010 @ 16:00

    which is in Base and Utils but whereis I can’t find in Cygwin

  • a Sep 2, 2010 @ 9:23

    thx mate,
    I had terrible bugs because I named a variable PATH

    find … | while read

  • praveen Oct 31, 2010 @ 8:03

    export PATH……………

  • chamberlain 7th Jan 25, 2011 @ 8:46

    it worked! thanks! very useful

  • ambitious Feb 16, 2011 @ 22:13

    hey there I am using backtrack4 in windows 7 my graphics card is atı hd 5650
    when ı command this :
    airodump-ng -w captura -c 11 — bssid 00:3e:d7:65:e2:87 wlan0
    bash: 3e: command not found

    note :I can see all of wifi/wlan etc.

  • kaosmonk Feb 24, 2011 @ 16:26

    do you happen to know where to look for that specific message “command not found” in centos? I’d like to chnage it to something else but am not able to locate it anywhere… have found it in other distros like ubuntu/debian – they have it in /etc/bash.bashrc and they even have such package by name command-not-found… and I was able to replace it with desired content… so, is there a way to perform the same on centos?

  • chat Mar 7, 2011 @ 15:14

    oldmodes is the users: command not found

  • Deswal Apr 8, 2011 @ 2:21

    I am using cygwin and when i compile program
    by command gcc -o hello
    it shows installation problem,cannot exec ‘cc’plus’:No such file or directory

    but when i execute program with command ./hello.exe
    it shows output

    how should i remove this problem plz tell me.

  • amir May 17, 2011 @ 9:30

    Hi . I am using Red hat E 4 and i am working bops simulator.
    after compile makefile , bops exe is producted and existed.
    but by input command :bops test
    Error is : bops :not command found.

  • Radhika Jul 14, 2011 @ 10:37

    hi, I have installed ns2 simulator in fedora5.The installation happened perfectly,
    but when i start opening ns,I am geeting error as command not found
    error :command not found
    please help me if i need to set any variables

  • ramani Jul 15, 2011 @ 7:17

    i dont get vi editor screen.whan i type “vi file name” i get the answer as command not found.i will be in /bin/bash. how did i over this problem.

    • sujith Apr 13, 2012 @ 17:06

      try vi

  • Vadim Sep 1, 2011 @ 8:29

    Thank you so much!!

  • sandeep Sep 16, 2011 @ 10:23

    while using proc command in cygwin its displaying
    bash:proc -command not found

    can you please help me on this?

  • Justin Oct 1, 2011 @ 12:38

    I just found this thread through Google.

    My situation was similar, but the resolution was simple and different. It wasn’t related to the code at all.
    I was on my Windows 7 machine connecting to my UNIX server through Notepad++ using the FTP plugin.

    I was getting the same error mentioned here –
    } ./
    ./ Command not found.

    After looking at the initial things I was like “Doh!” and I checked the Notepad++ -> Edit Menu -> EOL Converstion settings and of course it was set to Windows and not UNIX.

    After I set it to UNIX and uploaded the latest copy, the program executed without problems.

    Just thought I’d note that here in case people have the same issue.


    • Amir May 7, 2012 @ 20:52

      Thank you. I had some issue similar to yours and this helped me :)

  • Deepak Nov 9, 2011 @ 12:50

    hi, I have installed ns2 simulator in fedora5.The installation happened perfectly,
    but when i start opening ns,I am geeting error as command not found
    error :command not found
    please help me if i need to set any variables

  • vasanth Mar 8, 2012 @ 4:05

    How to resolve it…. IBM AIX 5.3….. Please help..

     man chlv
    sh[9]: tbl:  not found.
    sh[9]: nroff:  not found.
    sh[9]: col:  not found.
    # man chvg
    sh[9]: tbl:  not found.
    sh[9]: nroff:  not found.
    sh[9]: col:  not found.
    # man mkvg
    sh[9]: tbl:  not found.
    sh[9]: nroff:  not found.
    sh[9]: col:  not found.
    # man lspv
    sh[9]: tbl:  not found.
    sh[9]: nroff:  not found.
    sh[9]: col:  not found.
  • sujith Apr 13, 2012 @ 17:04

    i want to check whether the unzip command has worked properly.. i mean to say whether unzip have unzipped all the file or folders correctly in an another folder..based on that i have to send notification….i think there is some option called $? where i can check in the particular folder ..if it is suceesful, i will get value 1..i am not sure..please let me know…

  • Toufiq Apr 14, 2012 @ 7:37

    i m getting error as bash : command not found while compilation c programming can you tel me how to get rid of it.

  • flintiii May 30, 2012 @ 12:40

    This happens under Cygwin. You find yourself using two editors, one in Window$ and one in LInux. What happens is you get DOS cr/lfs (^M) in the file and these create all sorts of havoc in the bash command stream.

    The only way out is to keep the streams separate.

  • Piyali Jul 7, 2012 @ 16:42

    Hi everybody,
    I have installed ns2 and cygwin in windows 7. it works. but I faced one problem. when I want to run tcl and write ns simple.tcl it shows -bash: ns: command not found…..kindly solve my problem.waiting for your reply………

  • couldn't read file "namtrace-all": no such file or directory Jul 18, 2012 @ 7:57

    i have installed ns2 suhan it gives errorcessfully but when i run a programme
    it gives error
    couldn’t read file “namtrace-all”: no such file or directory
    my prograame is
    set ns [new Simulator]
    set nf [open out.nam w]
    $ns namtrace-all $nf

    proc finish {} {
    global ns nf
    $ns flush-trace
    close $nf
    exec nam out.nam &
    exit 0 }

    set n1 [$ns node]
    set n2 [$ns node]
    $ns duplex-link $n1 $n2 1Mb 10ms DropTail
    $ns at 5.0 “finish”
    $ns run

  • sampath Jul 23, 2012 @ 7:02

    hi frnds,
    yum server installing step the createreppo, command not fount &-bash this command not fount what’s the prblm? wt 2 to 4 that one?

  • gregg Aug 10, 2012 @ 14:01

    another reason scripts can fail is because the line ending is DOS instead of UNIX. i am guessing that this is because the first line that specifies the interpreters name will see the extra linefeed. this can happen if you used any windows-based line editing app… even vi on unix will continue in DOS mode if it finds a linefeed anywhere in the file, so just editing with vi is not enough to convert the file.

    try running the dos2unix command on your script to rewrite the script without linefeeds.

  • Mallika Sep 22, 2012 @ 1:22

    Needed dos2unix, that had been my problem – but I see that’s already been mentioned here! It seems I get better error messages as root

    [root@xxx bin]# ./
    -bash: ./ /bin/sh^M: bad interpreter: No such file or directory
    [root@xxx bin]# su yyy
    xxx:yyy 1> ./
    ./ Command not found.

  • shreekanth Sep 30, 2012 @ 16:37

    bash : ls: command not found in linux to chnge the directories or to opening the vi editor

  • Monica Mar 6, 2013 @ 7:03

    Thank you very much! Setting the variable path works!

  • rob Jul 27, 2013 @ 11:49

    why these are command not found in the binutils-build?

  • Cherry Sep 17, 2013 @ 18:01

    i installed nasm . now when i assemble in terminal ,it produces the .o file but when i write the command for linking, ld -o str str.o , it says bash: ld: command not found… what’s wrong?

  • Manjeet Sep 29, 2013 @ 10:47

    I have created a simple script in a file and stored at location (/home/mint).I have changed the file permission to 755 to make it executable.However when i type file name on terminal it shows me that “Command not found”. Here is the solution:
    1) File name
    #!/bin/sh -x
    ls -l
    2)Stored at location /home/mint
    3)make it executable
    $chmod 755
    5)add the location of file in the PATH variable
    $export PATH=$PATH:/home/mint
    6)ls command should be in the path as per $PATH variable value.
    you could checke for ls command in /bin,/user/bin etc
    type and hit enter it should work.

    This is my first script so If I am not wrong, is a command itself to unix after making it executable.So it is searching this file in the $PATH if it is not there then there is a error.”Command not found”

  • kARAN Oct 9, 2013 @ 14:30

    hey i get this as i open terminal
    “ns-allinone-: command not found”
    also i cannot run tcl file.
    What is the solution?

  • krithika Jul 24, 2014 @ 17:38

    I installes the ns-2.35 in fedora 15. i dont have problem in running ns but still i cant run nam. It shows bash: nam:command not found. i set the environment path too. but still i get this error.

  • Raghavendra Jan 22, 2015 @ 11:38

    i am trying to compile on linux server and i am getting the following error :

    ./compile[94]: /usr/bin/gcc: not found [No such file or directory]

    Please help me in this error

  • AskQuestion May 4, 2015 @ 8:03

    Can you tell me why `which cd` command doesn’t print anything on the screen ? I had read some where over the internet and i forgot. Can you please give information on this ?

  • AskQuestion May 4, 2015 @ 8:05

    @Raghavendra, you need to install GCC on that linux machine.
    If you are using CentOS/RHEL/Fedora you follw this command
    #yum install gcc
    For Debian/Ubuntu
    #apt-get install gcc

  • raj May 9, 2015 @ 20:53

    I am using Ubuntu 14. I want to use arm tool chain to compile my code. My tool chain is in
    # /home/raj/el/arm/bin/

    Now i added this path using export and path variable as follow :
    # export PATH=/home/raj/el/arm/bin/:$PATH

    Now I want to compile my code with arm gcc compiler but it through error by saying that
    No such file or directory but when i am using
    # which arm-gcc
    it is showing path..
    I dnt understand why is this error. I am not able to cross-compile my code for arm target.

  • Jhonnatan Ordoñez Jun 16, 2015 @ 21:05

    I can help , I have installed Fedora 21 from Friday and I could not log in, and try to start again and show me the login screen , and does not show me any errors, income and command line appears:

    -bash: id: command not found
    bash: ls: command not found…
    Similar command is: ‘lz’
    bash: tty: command not found…
    Similar command is: ‘tty’
    bash: grep: command not found…

  • aref ghobadi Aug 21, 2015 @ 18:15

    thank you

  • anand Apr 7, 2016 @ 19:55

    Gcc not found error is accure ….what i do for Debian system

  • maheshm Jun 15, 2016 @ 14:26

    Hi All,

    i have below script for History & sos backup. its working fine in RHEL5.8 and i have configured new server RHEL6.6, when i try to run this script i am getting an error message “ls: cannot access /root/new/2016/June: No such file or directory”

    dPATH="/root/new"                  # Configure the backup directory path here #
    tDate="$(date +"%d-%m-%y_%H-%M")"
    tYEAR="$(date +"%Y")"
    tMONTH="$(date +"%B")"
    tDAY="$(date +"%d")"
    tTIME="$(date +"%H-%M")"
    gdFTIME="$(date +'%d%b%Y')"
    dFIND="$(ls $dPATH/$tYEAR/$tMONTH | grep $gdFTIME*)"
    hFile="$(find /home -name .bash_history)"
    hFileUser="$(find /home -name .bash_history | awk -F'/' '{print $3}')"
    if [ "$dFIND" != "" ]; then
    for dP in $dFIND
                    mkdir -p $dPATH/$tYEAR/$tMONTH/$dP/History_backup-$gdFTIME >> $tmpPATH/History_backup$tDate.log
                    mkdir -p $sosName >> $tmpPATH/History_backup$tDate.log
                    /usr/sbin/sosreport --tmp-dir $sosName/ --batch -n emc
                    echo "SOS Report has been created and placed" >> $tmpPATH/History_backup$tDate.log
            for i in $hFileUser
                            cd $dName
                            cp $n $i-history-$tDate.txt
                            echo "$i: $n Copied..." >> $tmpPATH/History_backup$tDate.log
                            tar -czf $i-history-$tDate.tar.gz $dName/$i-history-$tDate.txt
                            echo "$n archived..." >> $tmpPATH/History_backup$tDate.log
                            rm -rf $i-history-$tDate.txt
                            echo "$i-history-$tDate.txt deleted..." >> $tmpPATH/History_backup$tDate.log
                            ## Cronjob Backup ##
                            getCJList=( dgcx root )
                            cd $dName
                            for cj in ${getCJList[@]}
                            if [ "$cj" != "" ]; then
                                    echo "Creating File : $dName/crontab-$cj-$gtHSTNAME-$tDate.txt..." >> $tmpPATH/History_backup$tDate.log
                                    touch crontab-$cj-$gtHSTNAME-$tDate.txt
                                    echo "$(crontab -lu $cj)" > crontab-$cj-$gtHSTNAME-$tDate.txt
                                    echo "Archiving File : $dName/crontab-$cj-$gtHSTNAME-$tDate.txt..." >> $tmpPATH/History_backup$tDate.log
                                    tar -czf crontab-$cj-$gtHSTNAME-$tDate.tar.gz crontab-$cj-$gtHSTNAME-$tDate.txt
                                    echo "Removing File : $dName/crontab-$cj-$gtHSTNAME-$tDate.txt..." >> $tmpPATH/History_backup$tDate.log
                                    rm -rf crontab-$cj-$gtHSTNAME-$tDate.txt
                                    echo "User $cj doesn't have cronjobs : IGNORE" >> $tmpPATH/History_backup$tDate.log
                            cd $dName
                            cp /root/.bash_history $dName/root-history-$tDate.txt
                            tar -czf root-history-$tDate.tar.gz root-history-$tDate.txt
                            rm -rf root-history-$tDate.txt
                            chown user.user $OwnFolder -R
  • Ratnaji Jul 7, 2016 @ 12:28

    Iam seeing double entries:
    [radha@ip-172-31-10-140 ~]$ $PATH
    bash: /sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/bin:/home/radha/apache-hive-2.0.0-bin/bin:/home/radha/hadoop-2.6.0/bin:/opt/aws/bin:/home/radha/hadoop-2.6.0/bin:/home/radha/apache-hive-2.0.0-bin/bin:/home/radha/hadoop-2.6.0/bin:/bin:/usr/local/bin:/opt/aws/bin:/home/radha/hadoop-2.6.0/bin:/home/radha/apache-hive-2.0.0-bin/bin:/home/radha/jdk1.8.0_77/bin:/home/radha/hadoop-2.6.0/bin:/opt/aws/bin:/home/radha/hadoop-2.6.0/bin:/home/radha/apache-hive-2.0.0-bin/bin:/home/radha/jdk1.8.0_77/bin:/home/radha/hadoop-2.6.0/bin: No such file or directory

    vi .bashrc

    I have added the below entries in bashrc file:
    # User specific aliases and functions
    export JAVA_HOME=$HOME/jdk1.8.0_77
    export PATH=$PATH:$JAVA_HOME/bin
    export HADOOP_HOME=$HOME/hadoop-2.6.0
    export PATH=$PATH:$HADOOP_HOME/bin

  • Anrik Jun 1, 2017 @ 21:39

    : command not found

    Check for control characters or extra spaces at the end of a continues line. In vi (:set list).
    cd /home/user; \ $ (there is a space between \ and $)
    cd /home/user; \^M (Wrong type of carriage return)
    Once space and carriage return were fixed the script ran.

  • Sharad Kumar Sep 5, 2017 @ 13:08

    Sometimes this can be due to some comments with “#”. So removing those can help too.
    Ex :
    # Author : My script

    So remove these lines.

  • Alphy Gacheru Oct 28, 2020 @ 9:26

    Thank you much!

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum