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.

564 questions
358
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
  • 3,805
  • 2
  • 15
  • 9
186
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
  • 19,673
  • 28
  • 87
  • 128
172
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,578
  • 2
  • 10
  • 7
164
votes
9 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
162
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 executable.…
cat
  • 3,428
  • 4
  • 22
  • 50
155
votes
4 answers

Where should a local executable be placed?

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…
138
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,137
  • 3
  • 15
  • 11
117
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
  • 5,788
  • 16
  • 40
  • 48
116
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,208
  • 2
  • 7
  • 17
114
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…
jrara
  • 2,069
  • 8
  • 23
  • 20
106
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?
Nicolas de Fontenay
  • 4,209
  • 8
  • 21
  • 18
93
votes
14 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,061
  • 1
  • 7
  • 3
91
votes
1 answer

Why does the following 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
user253751
  • 2,211
  • 2
  • 16
  • 17
89
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,400
  • 3
  • 10
  • 17
80
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
  • 967
  • 1
  • 7
  • 10
1
2 3
37 38