date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,356,038,512,000 |
Before, I was using Linux Mint and I can run bash script directly from desktop just with chmod the script to executable. For example, I have a script like this:
#!/bin/bash
VBoxSDL --startvm virtualmachine
then:
chmod +x myscript
In desktop. I just need to double click the script that I've created.
Now, I'm using Ar... |
If that isn't working then you can create a .desktop file for your script. It would look something like this:
# $Id: vbox-starter.desktop 22 $
[Desktop Entry]
Name=Custom Virtualbox Starter
GenericName=VBox
Comment=VBox
Exec=VBoxSDL --startvm virtualmachine
Terminal=true
Type=Application
Icon=Virtualbox
Categories=GN... | Executable script can't run directly from desktop in Arch Linux |
1,356,038,512,000 |
I want to find out whether it is possible to circumvent an executable's gui by calling the programs internal worker methods/functions directly.
Assuming the executables are C/C++ programs with a working Gnome or KDE interfaces on Linux.
|
This can be done in special cases. What you describe is something like dynamically loading plugins via the C dynamic linking loader: try man dlopen for details on that. Usually the code so called has to be compiled as "position independent", so you're almost certainly out of luck for any specific program.
You could lo... | Is it possible to call an executable's functions? |
1,356,038,512,000 |
I'm using Elementary OS. How do I mark a .jar file as executable. I do have JDK installed, but I get an error saying it isn't marked as executable.
|
You can either open a terminal and run
chmod +x yourfile.jar
or right-click the file in the file manager, open the Properties window, switch to the Permissions tab and check the Execute box in the Owner: row.1
1: At least that's the way it works in Nautilus/Files (GNOME's default file manager) which Pantheon's Files ... | Mark as executable |
1,356,038,512,000 |
I have a bunch of java command-line programs I've written and would like to install for all users.
Building with NetBeans, I get a /dist directory which contains myprog1.jar and a /libs directory with all the necessary libraries. The usual method to run is to go there and java -jar my.jar -options.
So what I'd like t... |
You can write a single wrapper script that executes a jar named after the way it's called, and make one symbolic link for each jar. Here's the jar-wrapper script (warning, typed directly into the browser):
#!/bin/sh
name=$(basename "$0")
jar=
for dir in /opt/myjava/*; do
if [ -e "$dir/$name.jar" ]; then jar=$dir/$na... | How do I install multiple java command-line programs? |
1,356,038,512,000 |
I made fish function in ~/.config/fish/functions/confgit.fish:
function confgit
/home/john/Projects/confgit $argv
end
But when I run this function it just says:
fish: The file “/home/john/Projects/./confgit” is not executable by this user
/home/john/Projects/./confgit $argv
^
in function 'confgit'
... |
I worked to reproduce your problem, and the closest thing I could emulate was this:
# file: ~/bin/janstest
echo $argv
# file: ~/bin/janstest2
function janstest
~/bin/janstest $argv
end
janstest It works!
and file permissions as:
stew@stewbian ~> ls -l ~/bin/jans*
-rwxr-xr-x /home/stew/bin/janstest*
-rwxr-xr-x /ho... | Fish: The file is not executable by this user |
1,356,038,512,000 |
How to create an executable shared-library using cmake?
Something like:
libtest.so :: linkable shared library
libtest.so :: executable too
Note: gcc/g++ options are known to achieve the same (https://unix.stackexchange.com/a/223411/152034). But the solution needs cmake way
|
NOTE: First information regarding this is, there is seemingly an open issue related to cmake. Therefore this can be considered as an indirect solution to achieve the same.
Now follow the illustration using cmake.
test.cpp
#include <stdio.h>
void sayHello (char *tag) {
printf("%s: Hell... | Building shared library which is executable and linkable using Cmake |
1,356,038,512,000 |
I downloaded Singular, from the terminal. I simply can't find it now that it's installed! It's not in my installed applications and the command "singular" on the terminal gives nothing.
How do I start it?
|
Try Singular with upper case S.
As you can see in the list of files installed be this package here, the executable is /usr/bin/Singular. The same with different architectures.
| Installed "singular" and can't start it |
1,356,038,512,000 |
I was looking at Linux audit reports. Here is a log from ausearch.
time->Mon Nov 23 12:30:30 2015
type=PROCTITLE msg=audit(1448281830.422:222556): proctitle=6D616E006175736561726368
type=SYSCALL msg=audit(1448281830.422:222556): arch=c000003e syscall=56 success=yes exit=844 a0=1200011 a1=0 a2=0 a3=7f34afa999d0 ite... |
The nroff "executable" provided by groff is a shell script, e.g.,
#! /bin/sh
# Emulate nroff with groff.
#
# Copyright (C) 1992, 1993, 1994, 1999, 2000, 2001, 2002, 2003,
# 2004, 2005, 2007, 2009
# Free Software Foundation, Inc.
#
# Written by James Clark, maintained by Werner Lemberg.
# This file is ... | auditctl comm vs. exe |
1,356,038,512,000 |
I currently am using Xamarin Studio, which has a bug in this version. It adds 2 parameters to an executable, which causes the output to flood with error messages, slowing down the build time from a minute to at least 10 minutes.
Is there a way I can move the original executable and create a bash script or a link, whic... |
The canonical way is a loop shaped like:
#! /bin/sh -
for i do # loop over the positional parameters
case $i in
--notices|--warnings) ;;
*) set -- "$@" "$i" # append to the end of the positional parameter
# list if neither --notices nor --warnings
esac
shift # remove from the head... | link to an executable and remove some parameters |
1,356,038,512,000 |
I have this desktop entry:
[Desktop Entry]
Name=dummy
Type=Application
Terminal=false
Icon=/home/xyz/Software/Test/ico.png
Exec= /home/xyz/Software/Test/start
which is supposed to execute file containing:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./Linux/lib
exec ./foo --gc=sgen
I have tried creating symlink, but res... |
The problem is that you're using relative paths in the script: ./Linux/lib, ./foo. These paths are relative to the current directory. The current directory of the process running the script is the current directory of whatever process launched it; it has nothing to do with the location of the script. When you run the ... | *.desktop nor symlink works (just for this one file) - Linux Mint 17.2 Cinnamon |
1,356,038,512,000 |
I was reading the man page of chown. I don't understand why S_ISUID and S_ISGID mode should be cleared when the function returns successfully.
|
I think you're pointing to this from the man page:
When the owner or group of an executable file are changed by an
unprivileged user the S_ISUID and S_ISGID mode bits are cleared.
So why are they cleared now. You see they are only cleared in case of an executable file.
Because when one of the bits (SUID/SGID) is ... | Why the S_ISUID and S_ISGID mode bits got cleared when the owner or group of an executable file are changed by an unprivileged user |
1,356,038,512,000 |
I downloaded the Linux executable for Unetbootin 494, and now I'm trying to run it. As root, I made it executable and attempted to execute it:
chmod +x unetbootin-linux-494
./unetbootin-linux-494
Nothing happens and no output is displayed. ps -e | grep unetbootin shows nothing either. The file's size looks right (4.3... |
Short answer:
Installing ia32-libs and ia32-libs-gtk should fix the problem. The problem was pretty basic: running a 32-bit executable on a 64-bit system without the proper libraries doesn't work.
Longer answer:
My initial post might have been too hasty, but since I had a minor amount of difficulty finding a solution... | What to do with an executable file that simply doesn't execute? |
1,356,038,512,000 |
I wrote the following
#!/bin/bash
cd ~/bin/red5-1.0.0
gnome-terminal --working-directory=. -x red5.sh
red5.sh is the script to run (this is java written media server).
My script above opens new terminal but with error message
There was an error creating the child process for this terminal
Failed to execute child pro... |
The working directory does not affect your $PATH1, thus I guess what's happening can be understood if you do the same thing in a terminal, i.e.
$ cd ~/bin/red5-1.0.0
$ red5.sh
will not work either; what does work is one of the following:
$ cd ~/bin/red5-1.0.0
$ ./red5.sh # note the relative path to the scr... | How to create a script, which runs another script in separate terminal window and does not wait? |
1,356,038,512,000 |
I have a directory in which I am storing all my shell scripts and I would like new files to be made executable by default so that I don't have to go chmod u+x [file] everytime. Is there a way to make this happen. I tried chmod -R u+x [directory] but this only makes all the existing files executable not ones that I'm a... |
To make permissions apply to new files, you need an ACL (access control list). The main tool to do this is setfacl.
You can set ACLs on directories so that new files created in them are always world-writable, or owned by a specific group. You are specifically interested in making new files executable.
That would be... | Make every file in a directory executable by default? |
1,356,038,512,000 |
I'm trying to add pkill to my sudoers file, but I think I need the full path for it to not give a syntax error. Does anybody know how to find it?
|
A generic way to find where a command comes from, if your shell
supports it (bash does), is the type built-in. For example:
$ type pkill
pkill is /usr/bin/pkill
For non-commands, it may print different things, for example:
$ type cd
cd is a shell builtin
| What is the full path for the pkill command? [duplicate] |
1,356,038,512,000 |
A user has use of an application running on a Linux server. The application provides the user with an API that allows reading and writing files on the server, but does not offer any means of executing a file. Is that enough to ensure the user cannot execute commands on the server?
The underlying filesystem is not mou... |
Arbitrary names at arbitrary locations, limited only by filesystem permissions is probably escalatable to execute arbitrary code. There are a lot of files in $HOME that are automatically run upon login, for example. And new ones are added (e.g., all the systemd user session stuff is fairly recent). Or maybe $HOME/bin ... | If a user can only read and write files, is that sufficient to prevent execution? |
1,356,038,512,000 |
I'm stuck with the following (simple) problem :
I want a script to be executed every 10 minutes. This script calls executable files. I use crontab and ksh on a AIX 5.3 system.
The script makes use of relative paths, but changing the executable path to absolute didn't make any difference. So, after a few tries and this... |
change your shell script to provide a full or relative path to the executable:
./executableFile ...
In interactive use, you must either have . or the cardme/bin directory in your PATH: that will not be true in cron's environment.
| Execution of a program called by a shell called by crontab returns code 127 |
1,356,038,512,000 |
On my MIPS box I'm trying to run a program. I use a cross compiler for mips. When I run my program, I'm getting
Illegal instruction
I pulled of one binary from it, called cputest. It basically prints “hello world” with some delay. Here is what readelf tells about it:
readelf -a ./cputest.mips
ELF Header:
Magic: ... |
# cat proc/cpuinfo
system type: RTL8672
processor: 0
cpu model: 56322
An RTL8672 is not a full MIPS implementation, but a Lexra. You will need a customized toolchain that knows how to handle this.
Something like this, or for a binary-only toolchain, look for rsdk; e.g., this.
| “Illegal instruction” on a static MIPS binary |
1,356,038,512,000 |
I'm having an issue where when I transfer a Python file to my VPS via FTP and try to run it using ./foo.py I am returned with the error: : No such file or directory.
The error seems to indicate that the file I am trying to execute does not exist. But I can run the program with no problems using python foo.py which le... |
This happens when a file contains \r\n as a line terminator instead of \n, since \r is a C0 control code meaning "go to the beginning of the current line".
To fix, run dos2unix foo.py.
Example session:
ben@joyplim /tmp/cr % echo '#!/usr/bin/env python' > foo.py
ben@joyplim /tmp/cr % chmod +x foo.py
ben@joyplim /tmp/c... | Why does trying to run a python executable return ': No such file or directory' after transferring it to server via FTP? [duplicate] |
1,356,038,512,000 |
I downloaded and extracted the VSCode zip. I see the Code binary file, but doubleclicking it in my file manager does nothing. I also tried ./Code in console, but I only get bash: ./Code: cannot execute binary file. Just typing Code causes bash: Code: command not found. My guess is that it might be a dependancy issue, ... |
I found the solution based on another Q&A
So based on the file the Code is a 64bit executable and based on uname my system apparently is 32bit, which is different from what I thought.
| Unable to start vscode executable |
1,356,038,512,000 |
Actually I have installed Ant in rhel5 environment and set ANT_HOME variable in /etc/profile which points to /usr/local/ant/bin so when I execute command echo $ANT_HOME it gives correct path but I get ant:command not found when I tried executing it from other directory. I installed it using a tar named apache-ant-1.7.... |
This should make it work:
export PATH=$PATH:/usr/local/ant/apache-ant-1.7.1/bin
Make sure you update this PATH in your .bash_profile file or in any of the startup scripts under /etc/profile.d
| ant command not found when running from the path othe than ant installation directory |
1,356,038,512,000 |
I'm a bit confused. I just read this: http://www.es.freebsd.org/doc/handbook/binary-formats.html, which basically says that freeBSD uses the elf binary format. But when I compile my code I using cc, I get a file called a.out.
So what's going on here? Can I somehow specify in which format cc should build my code? Does... |
The a.out file is still leftover from when compilers were using the a.out format. If you check the file with file a.out you will see it is actually in ELF format.
To specify the name of the output file, use cc -o exec_name code.c.
| How to compile to a specific executable format? |
1,358,240,936,000 |
In a linux machine, we may have to compile our programs with respect to that linux machine.
Now, if we already have some other users (not root. A typical user.) who have already compiled many programs for this machine, is it possible to do something like this?
For instance, user oldGuy got mpirun, python, and several ... |
When you execute a program by typing its name (with no directory part, e.g. just mpirun with possible arguments), the system looks for a file by that name in a list of directories called the program search path, or path for short. This path is determined by the environment variable PATH, which contains a colon-separat... | Applying and linking all settings/binaries of one user to another user in Linux |
1,358,240,936,000 |
I have downloaded VS Code on Elementary OS, and I followed the setup instruction of Setting up Visual Studio Code on linux.
The executable file "code" seems to be unknown, it is not opening, Any ideas?
|
Try to open it by running in a terminal (Ctrl+Alt+T):
/opt/VSCode-linux-x64/Code
If it work you can make a shortcut (so you will only need to run code to open Code):
sudo ln -s /opt/VSCode-linux-x64/Code /usr/local/bin/code
| VS Code not working on Elementary OS |
1,358,240,936,000 |
I hope my title isn't confusing. I've got a CentOS 5 machine and I had Ruby 1.8.7 installed on here. So in order to upgrade my Ruby installation and gems/rails I
Uninstalled Ruby: sudo yum remove ruby
Downloaded the latest stable release of ruby and untared it: wget... && tar -zxf ....
Went through the usual instal... |
It seems you didn't uninstall the package that provides the gem executable, so it is still in /usr/local/bin/, and points to the no longer present /usr/local/bin/ruby interpreter.
You can either uninstall that package (recommended, since you've also removed the ruby package it depends upon), or just make sure ~/bin is... | Path issues with a source install |
1,358,240,936,000 |
I'm using x64 Ubuntu. A few months ago I accidentally messed up the groups/owners of all files on /, but managed to fix it using a VirtualBox install of Ubuntu.
Now I'm running into a problem that I think is related to that mistake. When I try to reinstall ia32-libs (Skype is having problems so I need to reinstall tho... |
Run ldd /usr/lib32/gdk-pixbuf-2.0//gdk-pixbuf-query-loaders and make sure every file is accounted for (the line must end with an address like (0xf7789000)). In particular, check the permissions on the dynamic loader /lib/ld-linux.so.2. This is the only file in the lot that could cause that particular error message, bu... | Problem when installing “ia32-libs” |
1,358,240,936,000 |
I had ldc2 and gdc compiled from source and working up until a month ago. Nothing has changed, except I can't remember the variable(s) I would set in the terminal to get ldc2 and gdc to work.
I get the following errors when trying to compile D source code; with gdc ($ /home/Code/D/gdc/Bin/usr/local/bin/gdc -o t4 t4.d... |
Here you can't even run the compiler executable, because it can't find the libraries it needs. gdc is looking for libmpfr.so.1 and ldc2 is looking for libconfig++.so.8.
If these libraries are still present on your system, perhaps in /home/Code/D/gdc/Bin/usr/local/lib, you can add that directory to the LD_LIBRARY_PATH ... | Cannot open shared object file when using D compiler |
1,358,240,936,000 |
I am trying to install the VMware client on my work computer, which is running CentOS 7 and on which I have superuser privileges.
When I run the command
sudo ./VMware-Horizon-Client-5.2.0-14604769.x64.bundle
I get the following error message
sudo: unable to execute ./VMware-Horizon-Client-5.2.0-14604769.x64.bundle: P... |
It sounds like you have NFS homes, and that the file is on a Kerberized NFS share, which means that even root can't read things in it. To work around it, as yourself (not root), copy the file to somewhere that isn't NFS (like /tmp), and then run it from there (or if /tmp is noexec, once it's there, copy it to somewher... | Unable to execute file with superuser priviliges |
1,358,240,936,000 |
I have made a small Snake game using C. When I open it via GUI (Nemo), nothing gets opened. But if I open it using the terminal, it works as expected. I've tried it on multiple computers with different OSes (Ubuntu, Mint etc) but all exhibit the same problem.
I also tried right clicking the file, selecting 'Open with ... |
This is the same result you get when browsing Nemo to /usr/bin and clicking on bash. Right?
You can put the shell command you want to run, invoking gnome-terminal, in a shell script.
(Nothing specific to it being a shell script. You could also code like isatty(STDERR) || execlp("gnome-terminal", "--working-director... | Opening an executable via GUI does nothing although opening it via terminal works |
1,358,240,936,000 |
I am trying to start supervisor service supervisor start, as root, but it gives me
env: /etc/init.d/supervisor: No such file or directory
Yet, I can clearly see that file exists:
[root@master vagrant]# ls -l /etc/init.d/ total 256
-rwxr-xr-x. 1 root root 2062 Oct 17 2014 atd
-rwxr-xr-x. 1 r... |
It's not complaining about the /etc/init.d/supervisor file itself, but most likely about the file it wants to execute as - usually the shell that appears on the shebang line in that file. It's a somewhat misleading error that I've seen many times before.
| Supervisor: no such file or directory even though it is there [duplicate] |
1,358,240,936,000 |
I downloaded a Java tarball, extracted the archive and copied over scp to a remote machine. Using the ls command, the java executable exists:
ubuntu@Ubuntu:~$ ls -la /home/ubuntu/jre1.7.0_55/bin/
total 420
drwxr-xr-x 2 ubuntu ubuntu 4096 Mar 18 03:54 .
drwxr-xr-x 6 ubuntu ubuntu 4096 Apr 30 12:55 ..
lrwxrwxrwx 1 u... |
Possibly the (Java) binary you are executing ( which is 64 bit binary) on 32 bit OS
| A file exists but executing it doesn't work |
1,358,240,936,000 |
I'm reading a book, Learning Unix for OS X by Dave Taylor. It says:
To quickly see all of the binary executables—Unix programs—on your
system,
Open the Terminal, hold down the Shift key, and press Esc-?,
or press Control-X followed by Shift-1 (using Shift-1 to get an
exclamation mark).
Before the commands are... |
The instructions in the book are for bash. Zsh is a different program with different key bindings.
In zsh, you can see a list of all commands (external, builtin, function, alias even keywords...) with:
type -m '*'
For just their names:
whence -wm '*' | sed 's/:[^:]*$//'
Or for the names of external commands only:
pr... | How to display all the unix commands available on the system? |
1,358,240,936,000 |
I have an executable program (no source code, just the compiled executable) that was made in windows (.exe extension). It doesn't use any graphics... it simply reads and writes files. I want to be able to run it in a linux shell script so that I don't have to switch operating systems to get my output. Is there a wa... |
Wine works even for Windows CLI apps.
| How do I run a windows executable in linux shell script? |
1,358,240,936,000 |
Why do Unix-like systems execute a new process when calling a function rather than a dynamic library? Creating a new process is costly in terms of performance when compared to calling a dynamic library.
|
Unix-like systems don't "call functions by executing new processes". They (now) have shared libraries like pretty much all other relatively modern operating systems.
Shells on the other hand do execute other processes to do certain tasks. But not all. They have build-in functions,implemented directly in the shell (or ... | Why do Unix-like systems execute a new process when calling a new function? |
1,358,240,936,000 |
The executable file should be in machine code.
So, will make system calls without a need for c libraries.
But, I can not figure out what this image means?
Is it just an abstraction method?
|
You have a program that calls a library function. In this case, it's the system standard library, also called “the C library” (but there are many other libraries that can be called from C code, this is just a name). “Library function” means that the code of the function is distributed as part of a library. There are t... | Do we need c libraries when running a program? |
1,358,240,936,000 |
Normally my Linux OS allows me to create runnable executables (like a.out), but when I attempt to download an .exe from the Internet, it basically is permission restricted (neither user has execution (-x) rights). The problem is, when I change the file permissions with either chmod u+x or chmod 777, and I try to run t... |
This is totally normal. .exe files are Windows executables, and are not meant to be executed natively by any Linux system.
However, there's a program called Wine which allows you to run .exe files by translating Windows API calls to calls your Linux kernel can understand.
To run a .exe program you first need to insta... | Cannot run .exe files |
1,358,240,936,000 |
I have a program to list database files.
It is called direkly from the shell like
db filename
to list the whole file, or like
db 'filename :: conditions'
to list only selected elements ...
Another way is to call it with a file, wich contains all parameters.
db < parameterfile
The content is like (quite the same as... |
You could write a shell script that removes the shebang line, if any, and passes the result to db. Place this script in a directory of your PATH. Otherwise you might have to specify the full path of the script in the shebang line. Use this script as the interpreter for your parameterfile.
Example script runparam to re... | Make STDIN executable with shebang |
1,358,240,936,000 |
In Linux, I had created a userid. After creating this, I encountered a problem that the .EXE Files are not opened on simple click. They seem to be not privileged for my user account.
How can I overcome from this?
|
Assuming these .exefiles were actually compiled for Linux (and your specific architecture) you need to ensure they have execute permissions:
chmod +x your_file_names_here
To make sure these files are actually meant to run on Linux, check the output of
file one_file_name_here
| Privileges on Linux? |
1,358,240,936,000 |
Although one can easily make an executable file named ./42 or even ./カラオケ, I find no common packages that include letter-free commands. On Ubuntu, for example, apt-file find . | grep -i -e '/[^a-z/_\-]+$' reports that every executable file's basename has at least a letter or underscore or dash. The only letter-free ... |
Counterexample: the [ command, the one you use when you write if [ "$foo" = bar ]. It's the same as test, except that it requires the final ] argument, and is a standard utility.
Yes, it's an executable file:
# ls -l "/usr/bin/["
-rwxr-xr-x 1 root root 51920 Mar 2 2017 /usr/bin/[
| Why do all standard commands include an ASCII letter? |
1,358,240,936,000 |
I have an executable i build on Ubuntu 16.04. The file size shown on the GUI and through the ls -l command is:
-rwxrwxr-x 1 alibivmuser alibivmuser 19108760 dic 20 15:49 NreSpeechApplication
And I know this means the actual size of the file is 19 MB. On my file system, the size is somehow similar (using ls -s):
18664... |
size shows the traditional sections of an executable file.
Notice that these traditional sections do not include debugging information, for example. Debugging information takes up a lot of space. For a complete list of sections, run objdump -h NreSpeechApplication
The total (dec/hex) is not directly tied to filesize... | Linux `size` command gives different results from `ls` |
1,358,240,936,000 |
I'm trying to run a cross compiler on my 64 bit Ubuntu. and it results in a following error:
$ ./arm-none-eabi-gcc
bash: ./arm-none-eabi-gcc: No such file or directory
The file is here and contains some data:
$ ls -la arm-none-eabi-gcc
-rwxr-xr-x 2 alan alan 776368 Sep 26 19:36 arm-none-eabi-gcc
$ head -n 1 arm-none... |
The error comes from the fact that you're missing the loader for the binary, /lib/ld-linux.so.2 (as indicated by file). Once you have that installed you'll be able to run ldd arm-none-eabi-gcc to see what's required in addition.
The executable is in a valid format, which the kernel understands, so you don't get an "E... | "No such file or directory" as error for wrong architecture [duplicate] |
1,358,240,936,000 |
Is it possible to create what the Mac Finder specifies as a "Unix Executable File" and run it in Terminal like any other command instead of creating a .sh or .command file? If so how and where can I learn how to make them? If not, how can I create a .sh file that can take options? For example, with the ls command you... |
Well...all you have to do is basically to chmod your file to have executable permissions. For example if you want to create a shell script, you don't need to have .sh or whatever, you just have to write a text file and save it with any name you want, it doesn't even need to have an extension or you can make your own i... | How to Create a Unix Executable File [closed] |
1,358,240,936,000 |
I have read that if folder has only x set permission to execute it actually means that you are permitted to search this directory. So how to search it?
|
You misunderstand. “Search” permission is a bit of a misnomer; if you have execution permission but not read permission on a directory, you can access a file in this directory only if you know its name. That is, given a name, you can search the file with this name (and, more importantly, you can access the file that y... | How to search folder with only x set (execution) permission |
1,358,240,936,000 |
Is there a philosophy behind running a folder as an executable in linux?
user@node main % ls -lash ./bin
total 0
0 drwxrwxrwx 2 user staff 64B May 23 21:04 .
0 drwxr-xr-x 6 user staff 192B May 23 21:04 ..
user@node main % ./bin
zsh: permission denied: ./bin
Permission denied implies that it may be a... |
Running a folder isn’t possible using Linux APIs. In particular, execve returns EACCES when an attempt is made to do so — this is what Zsh represents as “permission denied”, probably because that error can also be returned if execute permission is denied. The canonical error message for EACCES is “Permission denied”; ... | Is "running a folder" possible in Linux? |
1,358,240,936,000 |
Server is running FreeBSD 9.2.
Using vim, I wrote the following script called hello:
#!/bin/sh
echo "hello world"
Then I set it as executable:
>chmod 755 hello
Then I tried to run it from the command line (while in the same folder where the script was saved):
>hello
I got this error message:
hello: Command not foun... |
You must type:
./hello
If you type hello, the shell will try to find in $PATH any executable program named hello. In your case, you have not added your current folder to $PATH, so the shell can not find your program.
Dot . in ./hello represent your current working directory, so the shell can expand it to /full/path/t... | can't get hello world shell script to run in FreeBSD |
1,358,240,936,000 |
I have two shell script files with exactly the same permissions etc.
I can run one of them by just giving its name in the command line but for the other one I should use sh or ./ to run it.
What is the reason?
|
Odds are that the 2 scripts are in different directories. One of the directories is on the PATH while the other is not.
You can use the type command to test if a file is present on your current shell's $PATH.
$ type start_dropbox.bash
start_dropbox.bash is /home/saml/bin/start_dropbox.bash
See this U&L Q&A "How do I ... | Shell script execution |
1,358,240,936,000 |
ELF 'Executable and Linkable Format' So if I generate Shared Object files .so are those considered ELF files?
|
Yes, if you generate them on linux for native use. You can see this via file:
> file mylib.so
mylib.so: ELF 64-bit LSB shared object [...]
| Are .so files in Fedora considered ELF files? |
1,358,240,936,000 |
Windows EXE files which are in the PE format have a header and it contains a checksum.
Is it possible to verify it under Linux?
Because I am looking for a Linux command I hope you understand that this is a Linux and not a Windows question (please don't close it).
|
There are a number of tools to do this; one such is pefile, a Python library with a build-in PE checksum verification function:
#!/usr/bin/python3
import pefile
import sys
pe = pefile.PE(sys.argv[1])
if pe.verify_checksum():
print("PE checksum verified")
else:
print("PE checksum invalid")
(error-handling le... | Is it possible to verify a Windows EXE (PE file format) checksum under Linux? |
1,358,240,936,000 |
Very similar with Run a command in an interactive shell with ssh after sourcing .bashrc, yet the answer there doesn't work for me.
I want to to execute remote command via ssh under the full interactive shell. I.e.,
run a remote command under the login shell, with some parameters.
Basically, I need the following two ca... |
The shell -c command over SSH is problematic here; there are tricky
quoting issues and it is not clear to me who is running what when. Here
customjava is only known to something that reads ~/.bashrc for
testing purposes. ZSH is my default shell.
$ ssh -t localhost bash -c 'source ~/.bashrc;customjava -version'
/home/j... | ssh to execute remote command under interactive shell |
1,358,240,936,000 |
I'm not talking about a Windows EXE. I mean an actual Linux executable file.
At first, I've been wondering whether Linux executables even have embedded icons, and it seems as though they do, because there are programs for which I've never found the icons on my system (I might just be blind, and they were actually hidd... |
A program's icons can be found inside their package source files (not in the executable binary).
Icons for programs that have been installed should be in /usr/share/icons.
| How to Extract Icons from Executable File in Linux |
1,544,728,212,000 |
I have a library - users are to create executable files, potentially with a hashbang to tell exec which executable to use. If they omit the hashbang, then I think most systems default to /bin/sh, I want to change that default.
So some files might start with:
#!/usr/bin/env foobar
other files might start with:
#!/usr... |
You can implement this in two steps using execve: ask the C library to ask the kernel to execute the target, and if that fails, try again with foobar. This is actually how shells commonly implement execution.
There are other exec family functions which will run shebang-less scripts with /bin/sh, but execve won’t.
What... | Change the default executable for file with potentially missing shebang |
1,544,728,212,000 |
I had a C program and made it executable on my 32 linux mint. For assignment purposes I had to test if it was working on university pool computers. I honestly don't know which linux distributions are installed there, just had two minutes didn't really take a look but I know that it's also 32 bit system.
So when I trie... |
Because you had not done chmod u+x, non unix files systems will not store this data, it is outside of the file: the execute bit was not copied to google-drive. Therefore you had to run chmod again.
On the machine that you compiled it you did not have to run chmod, as the compiler does this for you.
As long as you keep... | executable file problem after transfer to other system |
1,544,728,212,000 |
I downloaded several pre-built binaries of the same program (nodejs-linux, -x86, -x86_64). In different shells I get a similar error that no such file or directory: node. The $PATH is correct and the binaries exist and are executable.
Is this because I'm on a musl-based linux distribution and the binaries use glibc?... |
If your libairies dont match the dynamic librairies required by the executable, it won't even start. To check the dynamic librairies this executable is linked to, do:
ldd /path/to/executable
If you see => not found, you know what is missing.
| Various shells won't run a binary that exists |
1,544,728,212,000 |
I'm in dual boot with Windows, and i've created a shared ntfs partition.
I' ve cloned a project from github, use make to compile it but seems it isn't recognized as runnable. I've added the right permission and tried to change the owner of the directory.
This is the output of ls -l:
total 298
-rwxrw-rw- 1 federicop fe... |
Probably your NTFS volume is mounted with option noexec, which is the default enforced by permissions. See man ntfs-3g for details.
You could selectively enable exec option by adding it to fstab.
UUID=82440D36440D2F0B /media/federicop/Data ntfs-3g auto,users,permissions,exec 0 0
Run grep /media/federicop/Data /proc/... | Can't run c program in other partition |
1,544,728,212,000 |
I want to add a program to my $PATH, but its code is split into various files that it imports at run-time from a lib/ in its root directory.
projectRootDirectory
├ programBinary
└ lib
├ someLibrary
└ someLibrary2
How do I add such a program to my $PATH without it complaining about missing dependencies?
I'd norma... |
You can of course add projectRootDirectory to your $PATH, but this has at least two drawbacks:
It looks like, the way you are describing it, this particular project does not organize its project nicely into bin and lib subdirectories like so:
projectRootDirectory
├ bin
│ └ programBinary
└ lib
├ someLibrary
└ some... | How do I add a program with a directory of dependencies to $PATH? |
1,544,728,212,000 |
I have php shell and I have function that do just that (but it give me error when I call scandir($path) function because of restriction in php), so I need to use my bash shell to do the same.
It can be one command that list all 3 things separated by some delimiters or they can be 3 commands.
What is the best way to do... |
With GNU find, you could call:
find /some/dir -mindepth 1 -maxdepth 1 -type f \
\( -executable -printf 'X%p\0' -o -printf 'F%p\0' \) -o \
-type d -printf 'D%p\0'
The output will be a NUL-delimited (NUL is the only character that may not appear in a file path) list of records, the first letter of which identifies... | List files, directories and executables in current directory |
1,544,728,212,000 |
So I compiled FFmpeg from this guide as a standard user and it works fine as the user I compiled with but if i do sudo ffmpeg the program can't be found. Is it possible to make it accessible by root or do I need to rebuild logged in as root?
|
The issue here is that ffmpeg has not been placed in a directory that is in root's $PATH. The guide you linked to (in the future please include the steps here so we don't need to go looking for them) tells you to run this command:
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
This will cause ffmpeg's... | Compiled, can't access with sudo |
1,544,728,212,000 |
I am looking to download modelsim for ubuntu. But the site gives only .exe file. Can I still install the software? Does modelsim exist for ubuntu? If yes, where can I find it?
Thank you.
|
Some more information in the future would be nice. It would for example be good to know what you exactly tried to download. If you look at the website again, you will see that ModelSim PE is only available for Windows. For a linux version you will need to download ModelSim DE.
http://model.com/content/modelsim-de-simu... | Modelsim for ubuntu |
1,544,728,212,000 |
I wanted to set gsettings as /usr/bin/gsettings so I created an alias. But I am not sure if that works:
$ type gsettings
gsettings is aliased to `/usr/bin/gsettings'
gsettings is /home/linuxbrew/.linuxbrew/bin/gsettings
gsettings is /usr/bin/gsettings
$ which gsettings
/home/linuxbrew/.linuxbrew/bin/gsettings
Also a... |
Yes, the order is important: whichever one is first in the output of type is the one that will be executed. So, in your case, pandoc would run the alias, /usr/bin/pandoc, and gsettings would run /usr/bin/gsettings.
I can't actually find where this behavior is documented, where it is stated that the first result of typ... | Which binary would be run when we have multiple installations? |
1,544,728,212,000 |
I recently began messing with Desktop Entries in order to run some scripts at Gnome startup.
I've read through some freedesktop documentation, as well as this post on creating a startup script. I currently have a desktop entry working on startup, but it is not behaving in the way I was made to understand it should.
S... |
There are two portions required to execute a BASH script directly:
the shebang
the executable bit
The shebang should look as follows.
#!/usr/bin/env bash
(Using env is a best practice. It can also be written as the full path, e.g. #!/bin/bash.)
Then set the executable bit as follows.
chmod +x /home/detroitwilly/scr... | Desktop Entry Requires "bash" in Exec Value |
1,544,728,212,000 |
I tried upgrading pip3 using su -c 'pip3 install' --upgrade pip' because I got errors and it failed when trying to upgrade it as a normal user.
This removed the pre-installed pip from /usr/bin and dumped it in /tmp, replacing it with a system wide installation of pip which is only accessible by root. I haven't tried t... |
It's likely that this was the package manager's version of pip, I'd simply re-install using your package manager.
Fedora/CentOS
$ sudo yum reinstall python-pip
Debian/Ubuntu
$ sudo apt-get --reinstall install -y python-pip
| Is there a way to restore an uninstalled executable from bin? |
1,544,728,212,000 |
doing this in bash script
./Execute_program > MyOutput
I get a log file from the output, however this causes the output not to be displayed on the terminal screen. Is there any way to do the same but at the same time the output can be displayed on the screen?
|
Use the universal pipe fitting, tee. tee reads input, and duplicates the output to both standard output and the specified file:
./Execute_program | tee MyOutput
If you want to append to rather than overwrite the specified file, use -a:
./Execute_program | tee -a MyOutput
If you want to write to several files, just ... | How to run a program, redirect its output and display the output on the screen? [duplicate] |
1,544,728,212,000 |
I have build tools version 25.0.1 installed on a machine running Enterprise Red Hat Linux, 64 bit. When I try and run the aapt command, from the command line I get the following:
-bash: ./aapt: cannot execute binary file
From researching it looks like the issue is that the aapt executable was compiled for 32 bit. I... |
./appt is not a ELF formatted executable, it's a Mach-O executable. This format is used on macOS, so evidently you have a macOS executable, not a Linux executable. What does sudo rpm -q --file ./appt output?
You might what to see if there is a version of ./appt available to your system by executing: sudo yum --enable... | Android build tool command aapt “cannot execute binary file” |
1,544,728,212,000 |
I am facing a little issue: I have created an FTP server with vsftp and a web server with Apache 2.2.
Now, my goal is to make so that anyone can log into the machine via FTP and upload files (.html, .php) so that they are executable by apache.
The point is that they aren't.
In fact, the files get created with 600 priv... |
Apache process started by the user www-data (in Ubuntu, check for Debian).
Those files are created by ftp user. Owened by ftpadmin and have permissions read and write to owner only (group members and others cannot access).
For currently uploaded files
Add read and execute permissions to the other users
sudo chmod o+r... | FTP user creates file that are not executable by apache |
1,544,728,212,000 |
I have a binary file that needs to run at startup on all accounts (including unprivileged user accounts), so a command to run it will be put into /etc/rc.local. The program itself will have only execute permissions so that it cannot be read or modified by an unprivileged user. It is located in /usr/bin.
However, it ne... |
If it, as you say, "needs to run at startup on an unpriveleged user account", then it will necessarily have access to all files that the unpriveleged user account in question has access to.
You could create a dedicated unpriveleged user account for the purpose of running the script. Set the permissions on the secret k... | File that is only readable with root privileges |
1,544,728,212,000 |
This question, "Figuring out what OS is on which partition?", got me into thinking if you could run the executables from a mounted distro without actually having booted into said distro.
The answer to this question, "How to recover from a chmod -R 000 /bin?", got me into thinking that perhaps you could call the loader... |
Yes, provided that the running kernel is capable of running the binaries from the mounted distribution.
This requires that the mounted distribution is for the running processor architecture, or a compatible one. You aren't going to be able to run ARM binaries on an x86 processor, for example. Compatibility depends on ... | Can executables from a mounted distro's disk be run without booting into it? |
1,544,728,212,000 |
How should I locate all 32bit programs on my system ? I'm running a 64bit OS.
(There might be some , but I forget)
|
This is kinda crude, but should do the trick
find / -mount -type f -perm /111 -exec sh -c 'objdump -f {} | grep -q elf32 && echo {}' \;
-mount keeps us on the / filesystem
-type f restricts it to files only
-perm /111 restricts it to files with the executable bit
then we run objdump -f on the file and echo the file ... | Running 64bit OS , Find all 32bit programs on a system |
1,544,728,212,000 |
I am trying to run an executable on Angstrom Linux, but ash tells me
-sh: ./myEx: not found
I've checked with readelf the program interpreter and it is
root@beagleboard:~# readelf -l myEx | grep interpreter
[Requesting program interpreter: /lib/ld-uClibc.so.0]
This program interpreter is missing. I've tried to sym... |
I figured out which libc my system was using. In my case it was eglibc that, cross compiling with openembedded for Angstrom 2012.05, is the default choice. Cross compiling for eglibc resolves this issue.
I wrote this next part only for reference, because I asked bitbake mailing list and I didn't found anything about t... | ld-uClibc.so missing |
1,544,728,212,000 |
I am curious, in the following scenario, what kind of permission does a shell script or Java program has (owner/group/other)?
There is a script called run.sh, and it in turn calls a Java program a.java. The script and the java is owned by user A and have -rwxrw-r-- permissions. When they were run by user A, which perm... |
All processes start executing as the same user and group(s) as the process that call them, unless they are called through a setuid or setgid executable, i.e. one that has rws or r-s or -ws or --s in its permissions. The permission bits other than the s bit are irrelevant. The owner of the executable only matter if the... | permission and user/group of a program executed through a script |
1,544,728,212,000 |
I have installed the newest Erlang from source. As the final step I have executed
sudo make install
Among other things, it placed erl link in /usr/local/bin, but its permissions are insufficient for me to use, other than with sudo
lrwxr-x--- 1 root wheel 21B Apr 19 22:26 erl@
/usr/local/bin permissions:
drwx... |
Are you using chmod's -h option (from the man page: "-h If the file is a symbolic link, change the mode of the link itself rather than the file that the link points to")? I tried it, and it seemed to do the job:
sudo chmod -h o+rx erl
| No exec permissions on programs in /usr/local/bin |
1,544,728,212,000 |
I have a laptop with both a discrete and an onboard graphics card. I want to run a Game executable file using the discrete GPU but instead it runs on the obnboard one. How can I run it with the discrete GPU?
The game is not installed. It is a folder where I run the executable FILE.
OS: Pop! OS (Gnome)
CPU: amd ryzen ... |
For AMD or Intel GPUs, setting the environment variable DRI_PRIME=1 should do the job.
For nVidia GPUs, you additionally need __GLX_VENDOR_LIBRARY_NAME=nvidia, __NV_PRIME_RENDER_OFFLOAD=1, and __VK_LAYER_NV_optimus=NVIDIA_only.
(The "Launch using Discrete graphics card" menu option internally uses the switcheroo-contr... | How can I run an executable and tell it to use my discrete NVIDIA GPU instead of the onboard one? |
1,544,728,212,000 |
I have build a server that ships in executable format, and I want to register it as a service that I can start/stop/restart.
I have read the following questions and many others like it > How can I make an executable run as a service?
My issue issue is that I want the executable process to be stopped by systemctl if I ... |
Here's an answer for the simplest case.
All you need to do is create /etc/systemd/system/myservice.service. This is an INI file with a [Service] section.
A very simple service looks like this:
[Service]
ExecStart=/usr/bin/myapp arg1 arg2
Simply ensure this service exists, then sudo systemctl start myservice or sudo ... | Creating a systemd service in ubuntu that can be started/stopped |
1,544,728,212,000 |
I have encountered a package which installs its binaries with permission 555 instead of usual 755 in /usr/bin, i.e. prohibiting writing for everyone. I do not understand the reason for doing so... Can assume that they want to add extra security, but not sure.
My question is as follows: can having permissions 555 for b... |
If the file is owned by the root user, permissions normally don't matter, the root user will be able to do anything with the file regardless.
If the file is owned by a non-root user, then 555 could be pertinent to prevent the owner of the file rewriting the file (which could allow to e.g. embed malware or run some cod... | is there a reason to revoke write permission for executables in /usr/bin |
1,544,728,212,000 |
I noticed that most of my image files are green when the ls command is used but some of them look purple. Apparently .png and .jpg files are supposed to look Magenta while executable files are Green.
But when making a Beamer presentation only the 'executable images' work.
Why are my PNGs executable?
I am using Ubuntu ... |
Any file can be tagged as executable.
chmod 644 filename.jpg
will remove the execute.
This will give rw to owner, read to everyone else and remove execute.
Make sure that is what you want.
Added from good comment below:
use chmod -x filename.jpg it will clear the execute bits without changing other settings.
| Why are my PNGs executable? |
1,544,728,212,000 |
I see there is a question similar to this but that answer relates to Git, which I am not using here.
I often make small scripts that I send to others with very limited command-line skills to run. Is there a way to package my script so that users don't need to change permissions for my executable? I tried to package my... |
A simple way is to make a tarball, a compressed tar archive. It you create it with root privileges and the user extracts the content also with root access, the permissions should be preserved.
Examples
sudo -cvzf filename.tar.gz directory # create a compressed tar archive of the directory and its content
cd /to-wher... | How to ship files as executable? (no git) |
1,544,728,212,000 |
I have a small function in my .zshrc. It creates a command to search for and run an executable file, that may or may not exist, in the current directory, or a parent directory somewhere up the current path. I have the logic to find the executable, if it exists, however when I try to run it, I get the following error:
... |
The quoting around this line:
"$current_path/executable_file $@"
tells the shell that there's one item to be found and executed -- whatever is between the double-quotes (after the various variable expansions).
In the simplest case, with no parameters to your function, it will attempt to execute:
"$current_path/execut... | Running an executable without sudo |
1,544,728,212,000 |
I have Python code that is run using a bash script. I want non-sudo users to be able to run it without making the Python code readable. What is the recommended pattern?
Two ways I considered:
Put all code under user's HOME and make it non-readable and executable as necessary
Put all code under /usr/local and add re... |
One common way to make sure users can't read the source code of something they are causing to run would be to write a service which acts on the user's behalf with the necessary privileges. Then give users a way to communicate with the server, such as a socket or a TCP port. At this point the code is no longer running ... | Where to store proprietary code and executable scripts? [closed] |
1,544,728,212,000 |
I have a game executable at ~/Games/factorio/bin/x64/factorio that I want to run from dmenu. I've created the shortcut below:
[Desktop Entry]
Type=Application
Name=Factorio
Path=/home/[USERNAME]/Games/factorio/bin/x64
Exec=factorio
Terminal=false
...with [USERNAME] obviously being my username. dmenu picks up the file... |
Something that always worked for me was putting the whole path in the Exec section as follows:
[Desktop Entry]
Type=Application
Name=Factorio
Exec=/home/[USERNAME]/Games/factorio/bin/x64/factorio
Terminal=false
I don't know excactly what the Path section is for - I never used it.
| .desktop file will not launch the desired program, despite being identical in syntax to a working file |
1,544,728,212,000 |
I can't execute a simple executable.
The result of ll
user@user-SATELLITE-C855-169:~/Bureau/Workspace/buildroot/buildroot/output/host/opt/ext-toolchain/bin$ ll
total 16948
drwxr-xr-x 2 user user 4096 avril 18 2014 ./
drwxr-xr-x 8 user user 4096 janv. 18 21:01 ../
-rwxr-xr-x 1 user user 565152 avril 18 2014 a... |
Any help, what is meant by the * in the end of each file is there sth
special?
Your ll alias may contain -F option which adds a character after a file name. From man ls:
-F, --classify
append indicator (one of */=>@|) to entries
In many shells such as bash you can check how an alias is expanded using... | Executing a program gives No such file or folder error [duplicate] |
1,544,728,212,000 |
I was reading the man page for the ancient a.out format (located here), trying to understand the evolution of Unix executable formats. I was wondering about something. The man page says that if the magic number is OMAGIC, then the text segment is not shared with other processes and no write-protection is placed on i... |
That is done to align the data segment on a page boundary (which automatically forces it to be in a different page from the text segment). With that clue, you should be able find further information such as John Levine's explanation in Linkers and Loaders.
| a.out - Data segment and text segment are contiguous iff text segment is not shared. Why is this so? |
1,544,728,212,000 |
I want to know which executable gets executed for any command in bash.
Example:
I have firefox installed here /usr/bin/firefox, it is in the $PATH
alias browser=firefox
alias br=browser
Now I want to type something like getexecutable "br" and it should display /usr/bin/firefox
|
Here's a quick script I wrote further to my comment, that in the SIMPLE case of aliases will work. For anything with arguments/etc., though, it will fail miserably.
cmd="$1"
type=aliased
while [ "$type" = "aliased" ]; do
output="$(type "$cmd")"
type="$(cut -d ' ' -f 3 <<< "$output")"
cmd="$(cut -d '`' -f 2... | Get executable for any command [duplicate] |
1,544,728,212,000 |
I know this is to be done by creating a .contract file in /usr/share/contractor.
For example, one like this will add a menu option to open a folder as root.
[Contractor Entry]
Name=Open folder as root
Icon=gksu-root-terminal
Description=Open folder as root
MimeType=inode;application/x-sh;application/x-executable;
Exec... |
sudo gedit /usr/share/contractor/make_executable.contract
Add this content and save:
[Contractor Entry]
Name=Make executable
Icon=name.of.icon.wanted
Description=Make a file executable
MimeType=inode;application/x-sh;application/x-executable;
Exec=gksudo chmod +x %U
Should do the trick.
But it is possible that in el... | How to add 'Make executable' and 'Run' entries to Elementary OS file manager context menu? |
1,368,139,064,000 |
I'm trying to get a portable LaTeX installation running on a Gentoo Server. The LaTeX files are already installed.
When I try to run ./pdflatex in the path/to/texlive/bin/x86_64-linux/ I get the message exec format error: ./pdflatex. I'm running the command line with SSH with zsh.
Google told me that this could mean ... |
So I found the solution for my problem. I'm not sure if this will help anybody else. But just for completeness I post the answer here.
Even though uname -a returns x86_64 I got told that I should use objdump -a /bin/ls. This returns file format elf32-i386, so the correct binaries for me are the i386-linux binaries.
As... | Run portable LaTeX on Gentoo |
1,368,139,064,000 |
Im trying to make a desktop file to start Strife but it doesnt work as it should. For the current Path im using this here: '"$(dirname "$1")"'
And to run the executable I use this command:
'"$(dirname "$1")"/Strife/bin/strife'
|
I would be very surprised if a .desktop file is handled by your shell. You'd be better off hardcoding the full path in the Exec directive.
I found the GNOME Desktop Entry Specification which says:
The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or... | Gnomes .desktop current path |
1,368,139,064,000 |
It is said that in linux, unlike Windows, there's not a clear border between executables and other files.
Well, in Windows, I write a C++ program, then it is precompiled, compiled and then linked to become a distinguished file: executable. The changes are so much that they are not reversible.
But in Linux a simple te... |
tl;dr: the difference is the executable bit.
The answer lies in the UNIX permissions model. To be honest, I forget what the Windows permissions model is, but in UNIX (and hence GNU/Linux), there are three main permission bits that can be set on a file: read, write, and execute. These bits can be set on anything. There... | On executable files in Linux [closed] |
1,368,139,064,000 |
Looking at the files in my /etc/profile.d directory:
cwellsx@DESKTOP-R6KRF36:/etc/profile.d$ ls -l
total 32
-rw-r--r-- 1 root root 96 Aug 20 2018 01-locale-fix.sh
-rw-r--r-- 1 root root 1557 Dec 4 2017 Z97-byobu.sh
-rwxr-xr-x 1 root root 3417 Mar 11 22:07 Z99-cloud-locale-test.sh
-rwxr-xr-x 1 root root 873 Mar 1... |
A shell script only needs to be executable if it is to be run as
./scriptname
If it is executable, and if it has a valid #!-line pointing to the correct interpreter, then that interpreter (e.g. bash) will be used to run the script.
If the script is not executable (but still readable), then it may still be run with an... | Must shell scripts be executable? |
1,368,139,064,000 |
I source a bashscript (Child) inside another bashscript (Parent), somewhere in the middle of Parent. The argument passed to Parent when executing it gets passed to the Child. How can I prevent this behavior? I don't want the arguments of parent to be transferred to Child as well.
NOTE: Parent Child analogy is not abou... |
POSIX description of the . "utility" (Bash's source is a synonym) goes:
NAME: dot - execute commands in the current environment
SYNOPSIS: . file
DESCRIPTION: The shell shall execute commands from the file in
the current environment.
And the execution environment is defined to include:
Shell parameters that a... | Prevent bashscript argument being transferred to a child sourced script |
1,368,139,064,000 |
I have the Ecplise Platform (the programming environment, see https://eclipse.org/) on my system. It can be run by typing "eclipse" into the terminal.
Now I installed eclipse prolog (see http://www.eclipseclp.org/ ). I followed the instructions from http://eclipseclp.org/Distribution/Current/6.1_224_x86_64_linux/Readm... |
Figure out where the new eclipse is installed, and don't just enter eclipse but the full path: /where/the/new/eclipse/is/installed/bin/eclipse
If this new eclipse becomes your first choice, you may want to define an alias in your startup files (e.g. .profile for sh):
alias eclipse=/where/the/new/eclipse/is/installed/b... | How to run a program via terminal if it shares its name with another program |
1,368,139,064,000 |
Outside of a shell, such as running some other process, what does the term current directory mean, and is it possible to execute a binary without specifying the full path or the preceding './', assuming that the current directory contains the executable?
|
Yes, it is possible by setting up the search path appropriately (either containing your working directory explicitly or by containing "./"), but it is good practice to have the "./" in front of the program name. The reason is security: A malware could write an executable file with the name of a commonly used program (... | Is it possible to execute a binary without specifying the full path or the preceding './'? |
1,368,139,064,000 |
The environment variable PATH is the search path for executable commands, so I thought changing the PATH to something that doesn't exist (for instance, export PATH=blah) would make me unable to use any command.
After I change it, it doesn't let me use all commands (e.g. I can't use ls). But apparently, I can still use... |
You can still run builtin commands, i.e. commands internal to your shell thus not needing to be backed by an executable.
For example, if your shell is bash, you can have a look to: https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
Note that some commands that internally affect the shell l... | How come I can change my PATH to gibberish and still use commands? |
1,368,139,064,000 |
I have a directory like this:
/home/user/Project/
Inside Project and after many sub directories, I have a script names ninja that needs to be run with ./ninja. In other words:
/home/user/Project/sub1/sub2/sub3/ninja
Of course, I can just cd into Project and execute ./ninja. However, I am writing an alias to run that... |
Just append the path in the $PATH Variable in .bashrc like below:
export PATH=$PATH:/home/user/Project/sub1/sub2/sub3
And execute it from wherever you want in even without ./
$ ninja
But ofcourse you can set alias also
alias runNinja='/home/user/Project/sub1/sub2/sub3/ninja'
And execute from wherever:
$ runNinja
... | alias to run dot slash (./) on a file without cd using bash |
1,368,139,064,000 |
I used the following way to execute a collection of Bash script files, in the current Bash session:
source ~/myScripts/{assignments.sh,nginx_conf.sh,php_conf.sh,drush_install.sh}
It feels to me uncomfortable to maintain. Some vertical collection is better. Pseudocode:
assignments.sh
nginx_conf.sh
php_conf.sh
drush_in... |
A heredoc places each filename on its own line without anything else (though assumes that the filenames do not contain anything crazy like a newline) and allows for a specific ordering of the filenames:
while read f; do
source ~/myScripts/"$f"
done <<SRC_LIST
assignments.sh
nginx_conf.sh
php_conf.sh
drush_install.s... | Set two or more files for execution (via source) in a comfortable way to read |
1,368,139,064,000 |
When a daemon is executed, is the executable copied to memory?
If so, can it be copied encrypted?
If not, is there a way to prevent the executable from being copied to memory?
The executable is stored on an encrypted tmpfs.
|
When a program is executed, the necessary code pages are loaded into memory on demand. This is transparent: the kernel loads the pages when it needs them, and tries to be smart by preloading pages that are likely to be needed soon.
The code has to be decrypted before it can be executed. If the code is stored on an enc... | are daemon tmpfs executables copied unencrypted to memory upon execution? (prevent if so?) |
1,368,139,064,000 |
So I just bought a new Samsung T7 Portable SSD. I initially intended to format it to exFAT, for use with both Windows, MacOS and Linux, but upon inspection, the disk comes with a default file system of HPFS/NTFS/exFAT. I didn't know that was a thing, but I decided to test it out.
To test it out, I simply copied a few ... |
HPFS/NTFS/exFAT is a partition type. It claims the partition contains one of the named filesystem types, but that does not have to be the complete truth.
Try lsblk -o +FSTYPE or look into /proc/mounts while the partition is mounted to see the actual filesystem type.
Anyway, HPFS is unlikely, so the SSD most likely is ... | Files get executable when copied |
1,368,139,064,000 |
Note that the FS is mounted with the relatime option (thus the recent last access time is not shown).
Is there a way to see when an executable (ELF 64-bit LSB executable) was run for the last time?
Using root access. The idea is that a complex production application can run the same exec that currently exists at two d... |
As far as I recall, relatime updates the access time every 24 h or if the old atime was earlier than or equal to mtime. That would let you know if the program has been unused for a full day; or, if you don't care to wait, run touch programfile and then see if the atime has changed later.
Plain touch would set atime ==... | Is it possible to show when an executable was run for the last time? |
1,368,139,064,000 |
I have an external hard-drive formatted as NTFS which I use to back-up and store files from both Linux and Windows (as I am dual-booting). I recently bought a new computer and installed Linux Mint 20 on it, and I would like to copy some of the files from my back-up to my computer's internal HD. I noticed that every s... |
The answer is to use:
chmod -R -x+X .
See chmod(1)
| Recursively setting all files in a directory as non-executable [duplicate] |
1,368,139,064,000 |
What is the difference between the following
./executable and executable. Why is it, sometimes, some executable (non-Linux commands) don't require ./?
If I have installed an executable through a makefile (a physics code) how can I remove it and install an updated version? Is removing rm the code sufficient? The execu... |
In an UNIX environment (and even in other systems like DOS, Windows, etc) there are directories where the shell looks for executables. In an Unix environment it's defined in the PATH variable. You can see the directories in the PATH variable executing the following command:
$ echo $PATH
The result will be something l... | What is the difference between executable that requires ```./``` with the one not requiring it? |
1,368,139,064,000 |
This is on a Mac but I figure it's a Unixy issue.
I just forked a Github repo (this one) and cloned it to a USB stick (the one that came with the device for which the repo was made). Upon lsing I notice that README.md sticks out in red. Sure enough, its permissions are:
-rwxrwxrwx 1 me staff 133B 15 Jun 08:59 READ... |
Because the 'executability' of a file is a property of the file entry on UNIX systems, not of the file type like it is on Windows.
In short, ls will list a file as being executable if any of the owner, group, or everyone has execute permissions for the file. It doesn't care what the file type is, just what the permis... | Why would README.md show up as an executable? |
1,368,139,064,000 |
I have such a program to check methods of data from the command line:
me at me in ~/Desktop/Coding/codes
$ cat check_methods.py
#! /usr/bin/env python
from sys import argv
methods = dir(eval(argv[1]))
methods = [i for i in methods if not i.startswith('_')]
print(methods)
me at me in ~/Desktop/Coding/codes
$ python ch... |
Specify the path to the script, since it isn't in $PATH.
./check_methods.py list
And never add . to $PATH.
| Run python script without declare it interpreter |
1,368,139,064,000 |
I want to run an executable main and redirect all outputs to /dev/null, meanwhile I measure its runtime with time and write the results to runtime.out. Since the task is long I also have to run the whole thing with nohup.
I tried the following:
nohup time ./main &> /dev/null &> runtime.out &
This just outputs every... |
time has something made to be used for this:
nohup time -o runtime.out ./main &> /dev/null &
If it was scripted and didn't require a tty, I'd rather use setsid than nohup + &, because it "daemonizes" better, and can still be sent a HUP signal if needed.
setsid time -o runtime.out ./main </dev/null &>/dev/null
Also n... | Using nohup and time with different outputs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.