Could please someone tell me why there is an asterisk after the file "test"?

root@cp [~/c_projects]# vi test.c
root@cp [~/c_projects]# gcc test.c -o test
root@cp [~/c_projects]# ls
./  ../  test*  test.c
root@cp [~/c_projects]# ./test
Hello world!
root@cp [~/c_projects]# ls -l
total 36
drwxr-xr-x  2 root root 4096 Mar  9 15:29 ./
drwxr-x--- 26 root root 4096 Mar  9 15:28 ../
-rwxr-xr-x  1 root root 4694 Mar  9 15:29 test*
-rw-r--r--  1 root root   73 Mar  9 15:28 test.c
root@cp [~/c_projects]#

TIA

    What shell are you using? I'd GUESS it's because it's got execute permissions, but I've never seen that before.

    Try:

    touch test.test

    chmod +x test.test

    ls -l

    and see if it has the * after test.test

    I'm guessing that because ./test still runs your application, and you passed the arg to -o properly, so it's named "test", but ls shows the asterisk. I'm guessing it's for execute permissions - in my terminal, +x files are colored green.

      root@cp [~/c_projects]# ls
      ./  ../  test*  test.c
      root@cp [~/c_projects]# test
      root@cp [~/c_projects]# ./test
      Hello world!
      root@cp [~/c_projects]# touch test.test
      root@cp [~/c_projects]# chmod +x test.test
      root@cp [~/c_projects]# ls -l
      total 40
      drwxr-xr-x  2 root root 4096 Mar 10 15:47 ./
      drwxr-x--- 26 root root 4096 Mar 10 15:43 ../
      -rwxr-xr-x  1 root root 4694 Mar  9 15:29 test*
      -rw-r--r--  1 root root   73 Mar  9 15:28 test.c
      -rwxr-xr-x  1 root root    0 Mar 10 15:47 test.test*
      root@cp [~/c_projects]#
      

      I think you're right, although I haven't run across the asterisk before. Executables are green in my PuTTY bash console as well.

        yeah, that's my guess. I've just never seen it before. Maybe post up your .profile or .bashrc, but it looks like it's just because of the executable permissions.

          root@cp [~]# cat .bashrc
          # .bashrc
          
          # User specific aliases and functions
          
          alias rm='rm -i'
          alias cp='cp -i'
          alias mv='mv -i'
          
          # Source global definitions
          if [ -f /etc/bashrc ]; then
                  . /etc/bashrc
          fi
          root@cp [~]# cat .bash_profile
          # .bash_profile
          
          # Get the aliases and functions
          if [ -f ~/.bashrc ]; then
                  . ~/.bashrc
          fi
          
          # User specific environment and startup programs
          
          PATH=$PATH:$HOME/bin
          
          export PATH
          unset USERNAME
          
          export CVSROOT=/usr/local/cvs
          root@cp [~]#
          

          :\

            It'd be something in one of those include files, if present, or a skeleton file somewhere in /etc/skel, probably.

              3 years later

              Enter "alias" at shell prompt to see current alias settings. Look for "ls -F..."
              per "man ls" page:
              -F Display a slash (/') immediately after each pathname that is a directory, an asterisk (*') after each that is executable, an at sign (@') after each symbolic link, an equals sign (=') after each socket, a percent sign (%') after each whiteout, and a vertical bar (|') after each that is a FIFO.

              Some interesting excerpts from the bash manpage (indicating where that alias might be set):
              When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
              ...
              When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc.

              I believe you can "override" global alias settings by entering unalias ls (or alias ls='ls -...' w/ ...=whatever default ls switches you want), in your ~/.bashrc (w/o "**", of course)

                Write a Reply...