Questions tagged [executable]

The permission bit in a file mode that allows a file to be run as a program. Also, questions related the format of program files, and to locating and executing program files.

574 questions
381
votes
4 answers

How do I clear Bash's cache of paths to executables?

When I execute a program without specifying the full path to the executable, and Bash must search the directories in $PATH to find the binary, it seems that Bash remembers the path in some sort of cache. For example, I installed a build of…
Daniel Trebbien
  • 4,035
  • 2
  • 18
  • 9
212
votes
4 answers

Where do executables look for shared objects at runtime?

I understand how to define include shared objects at linking/compile time. However, I still wonder how do executables look for the shared object ( *.so libraries) at execution time. For instance, my app a.out calls functions defined in the lib.so…
rahmu
  • 20,681
193
votes
10 answers

How to find out the dynamic libraries executables loads when run?

I want to find out the list of dynamic libraries a binary loads when run (With their full paths). I am using CentOS 6.0. How to do this?
nakiya
178
votes
10 answers

How to chmod without /usr/bin/chmod?

Today I was told a tale by a Unix trainer where the root password got leaked to the students, and one of the fellas removed the execute permission from /usr/bin/chmod itself. How do you recover chmod in this case and make it executable again? Let's…
Sundar R
  • 1,638
175
votes
4 answers

Where should a local user executable be placed (under $HOME)?

I have an executable for the perforce version control client ( p4 ). I can't place it in /opt/local because I don't have root privileges. Is there a standard location where it needs to be placed under $HOME ? Does the File System Hierarchy have a…
165
votes
1 answer

How is Mono magical?

I'm learning C#, so I made a little C# program that says Hello, World! , then compiled it with mono-csc and ran it with mono : $ mono-csc Hello.cs $ mono Hello.exe Hello, World! I noticed that when I hit TAB in bash , Hello.exe was marked…
cat
  • 3,568
142
votes
7 answers

What is /usr/local/bin?

Before today, I've used the terminal to a limited extent of moving in and out of directories and changing the dates of files using the touch command. I had realised the full extent of the terminal after installing a fun script on Mac and having to…
JFW
  • 2,197
119
votes
6 answers

Why do we use "./" (dot slash) to execute a file in Linux/UNIX?

Why do we use ./filename to execute a file in linux? Why not just enter it like other commands gcc , ls etc...
Renjith G
  • 6,048
117
votes
9 answers

Why is /dev/null a file? Why isn't its function implemented as a simple program?

I am trying to understanding the concept of special files on Linux. However, having a special file in /dev seems plain silly when its function could be implemented by a handful of lines in C to my knowledge. Moreover you could use it in pretty much…
Ankur S
  • 1,218
115
votes
5 answers

Does the shebang determine the shell which runs the script?

This may be a silly question, but I ask it still. If I have declared a shebang #!/bin/bash in the beginning of my_shell_script.sh , so do I always have to invoke this script using bash [my@comp]$bash my_shell_script.sh or can I use e.g. [my@comp]$sh…
jrara
  • 2,099
115
votes
8 answers

#!/bin/bash - no such file or directory

I've created a bash script but when I try to execute it, I get #!/bin/bash no such file or directory I need to run the command: bash script.sh for it to work. How can I fix this?
102
votes
15 answers

chroot: failed to run command ‘/bin/bash’: No such file or directory

When I run the chroot command an error is given: failed to run command ‘/bin/bash’: No such file or directory
USER3254789
  • 1,151
92
votes
5 answers

How to recursively remove execute permissions from files without touching folders?

I made a backup to an NTFS drive, and well, this backup really proved necessary. However, the NTFS drive messed up permissions. I'd like to restore them to normal w/o manually fixing each and every file. One problem is that suddenly all my text…
gaazkam
  • 1,450
  • 3
  • 12
  • 20
92
votes
1 answer

Why does the following bash script delete itself?

If you create an executable file with the following contents, and run it, it will delete itself. How does this work? #!/bin/rm
89
votes
9 answers

Can a script be executable but not readable?

Is it possible to execute a script if there is no permission to read it? In root mode, I made a script and I want the other user to execute this script but not read it. I did chmod to forbid read and write but allow execute, however in user mode, I…
ashim
  • 1,057
1
2 3
…
38 39