You are not logged in.
Pages: 1
Good morning.
I say now: maybe i missed the section to post this problem, but i don't know where to put it.
I used "Geany" to create a C program... So, i wrote the code, compiled and built, but when i go to open the file from terminal, it return me "command not found"! Maybe i touched something wrong, but i can't start no other binary files (sh, x86 ecc.).
The commands that i tried are:
-For built files:
$ sudo ./program1.sh
[sudo] password for x:
sudo: ./program1.sh.sh: command not found
$ sudo ./program1.sh
sudo: ./program1.sh: command not found
$ program1.sh
bash: program1.sh: command not found-For x86 files:
$ sudo ./executable.x86
bash: ./executable.x86: command not foundHow to solve?
P.S. If I don't use "sudo", terminal tell me "permission denied" (and i am working on home)...
Last edited by bnvgriccardo (2016-06-21 18:21:45)
Offline
You don't need use sudo to execute your programs. Just give your files execute permissions.
Something like that
chmod +x program1.shOffline
"permission denied" anyway..
Offline
Don't use sudo. Change the mode of the script to executable. chmod +x program1.sh then ./program1.sh
Is there is a shebang as the first line of your program? #! /usr/bin/sh
If so, is the path to sh correct?
How did you build executable.x86 ? What are the output of file executable.x86
Here is the output for something that is executable:
ewaller@turing/home/ewaller[1] % file devel/C/backlight/src/backlight
devel/C/backlight/src/backlight: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=29fb731228b45076224e9bd877ae33bbb1921274, not stripped
ewaller@turing/home/ewaller %Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
"permission denied" anyway..
Who owns it. Please post the output of ls -l and of uname -a
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
If I add "#! /usr/bin/sh" on C file, Geany give out an error compiling:
program1.c:1:2: error: invalid preprocessing directive #!
#! /usr/bin/sh
^
Compilation failed.P.S. Now that I'm looking, the build Geany file isn't a "sh" (I think), on the file type is indicated "executable (application/x-executable)".
Last edited by bnvgriccardo (2016-06-21 18:18:13)
Offline
shebang isn't need for c source code, shebang using in shell scripts
#! /usr/bin/shuse ls -l in directory with your executable files
Offline
$ ls -l
total 32
-rw-r--r-- 1 x x 8232 May 10 18:40 program1
-rw-r--r-- 1 x x 2291 May 10 18:39 program1.c
-rw-r--r-- 1 x x 2912 May 10 18:40 program1.oLast edited by bnvgriccardo (2016-06-21 18:22:06)
Offline
in this directory execute
chmod +x program1 && ./program1Offline
Okay, so you are running a 64 bit system. good.
How did you compile program1 ? It is not executable. It should be. How did you do that?
What are the output of file program1 ?
Edit: And, note that my Shebang comment was couched with the word 'script'. If a file it ends with .sh, it understood to be a shell script.
Last edited by ewaller (2016-05-10 16:48:12)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
$ chmod +x contaCarStrLinee && ./contaCarStrLinee
Error: -1I don't know.. Is like that "./" is disabled
Last edited by bnvgriccardo (2016-06-21 18:18:54)
Offline
@ewaller
Compiled and built the file using Geany, there are those options.. I didn't use command line.
$ file program1
program1: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6903e61dad46d47b6e61be3403ae180e5db2ee8b, not strippedLast edited by bnvgriccardo (2016-06-21 18:19:08)
Offline
[bnvgriccardo@arch Documents]$ sudo ./executable.x86
bash: ./executable.x86: command not foundTime passes
[bnvgriccardo@arch MyProjects-10.05.2016]$ ls -l total 32 -rw-r--r-- 1 bnvgriccardo bnvgriccardo 8232 May 10 18:40 program1 -rw-r--r-- 1 bnvgriccardo bnvgriccardo 2291 May 10 18:39 program1.c -rw-r--r-- 1 bnvgriccardo bnvgriccardo 2912 May 10 18:40 program1.o
Time passes
[bnvgriccardo@arch Documents]$ chmod +x contaCarStrLinee && ./contaCarStrLinee
Error: -1WTF? Seriously, stop wasting our time. Pick one. Give us the actual commands you are typing. Give us the specific output.
Edit: You posted while I was ranting. Let me digest that.
Last edited by ewaller (2016-05-10 16:52:54)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
That should run. Change program1 to be executable with the chmod command.
Maybe this file system does not permit execution. What are the output of pwd and of mount
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
$ pwd
/home/x/Documents$ mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=1971896k,nr_inodes=492974,mode=755)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
/dev/sda1 on / type ext4 (rw,relatime,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=24,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
tmpfs on /tmp type tmpfs (rw)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
tmpfs on /run/user/120 type tmpfs (rw,nosuid,nodev,relatime,size=394908k,mode=700,uid=120,gid=120)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=394908k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sdb1 on /run/media/x/x type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)Last edited by bnvgriccardo (2016-06-21 18:20:39)
Offline
Okay, if we are trying to run something that is /home/bnvgriccardo/Documents, we are good to go.
Where is
[bnvgriccardo@arch MyProjects-10.05.2016]$ ls -l
total 32
-rw-r--r-- 1 bnvgriccardo bnvgriccardo 8232 May 10 18:40 program1
-rw-r--r-- 1 bnvgriccardo bnvgriccardo 2291 May 10 18:39 program1.c
-rw-r--r-- 1 bnvgriccardo bnvgriccardo 2912 May 10 18:40 program1.oAs this is not /home/bnvgriccardo/Documents. Is it, perchance, on your thumbdrive at /run/media/bnvgriccardo/RICKY which is a vfat volume?
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Sorry for the confusion.. At the start i had the files on my USB.. But now are in /home/documents, and I still can't run them!
Offline
Okay. So, in the directory with the (hopefully) executable program1, can we see the output of ls -l to get a a baseline from which to move forward?
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
$ ls -l
total 20
-rwxr-xr-x 1 x x 8232 May 10 18:40 program1
-rw-r--r-- 1 x x 2291 May 10 18:39 program1.c
-rw-r--r-- 1 x x 2912 May 10 18:40 program1.oLast edited by bnvgriccardo (2016-06-21 18:23:08)
Offline
And ./program1 does not work?
How about /home/bnvgriccardo/Documents/program1 ?
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Solved, just reinstalling gcc-libs and compiling the file again! I don't know what was the problem, but now is all ok... Sorry and thanks for the help
Last edited by bnvgriccardo (2016-05-10 19:01:22)
Offline
Pages: 1