My system is Manjaro Linux based on Arch Linux, I use bash and bash-completion.
It works perfectly when I type something as regular user (no sudo)
$ rfkill <TAB><TAB>
block event help list unblock
but when I type it with sudo
$ sudo rfkill <TAB><TAB>
Display all 3811 possibilities? (y or n)
Obviously, it tries to complete sudo command but I want it to complete rfkill.
I know I can change this behavior by editing /usr/share/bash-completion/completions/sudo file, but I have no idea how to say if second word is not a flag for sudo then use completion for next word.
Do you have?
UPD: I'm testing Ubuntu 16.04 in virtual machine and I see it works as expected. I'll check the difference between ubuntu's /usr/share/bash-completion/completions/sudo file and mine, if any.
UPD2: There is some mirror (meaningless) difference between these files, anyway that didn't help. I have more ideas to test...
I had exactly the same problem (running Manjaro) and found a solution in the Manjaro Forum (Source):
Make sure bash-completion is actually installed by checking whether /usr/share/bash-completion/bash_completion exists. If not install it with pacman -S bash-completion
In your ~/.bashrc file make sure that complete -cf sudo is commented out. Otherwise, this will make sudo only auto-complete filenames and commands but not use bash-completion.
I hope this helps you solving the problem
use double tab:
sudo rfkill <TAB><TAB>
UPD
if there is not that line, add this to your .bashrc
complete -cf sudo
in the picture below you can see that it says chmod command is not found yet it has chmod installed. I am installing metasploit directly from the terminal(I did not install any desktop environment and don't want to run msf from there). Is there any way to solve this? I would gladly appreciate any replies.
Instead of using that command, use this instead
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && chmod 755 msfinstall && ./msfinstall
Remove the backslashes from the composite Bash command, they're used in Linux to escape the space character. For example, ỳou would have to type:
cd ~/Documents/My\ Folder
to access
~/Documents/My Folder
By writing the command the way you did you were looking for the ' chmod' command instead of 'chmod', you've basically inserted a space before the command name.
I'd suggest studying Linux Bash scripting before venturing into Metasploit.
You would otherwise continually stumble against this kind of issues, also if you'd like to work with Metasploit from its command console it's pretty much mandatory to study Linux Bash scripting (and the Linux OS as a whole).
Due to lack of privileges/permissions/influence/power/charm/money, I am unable to install the full Cygwin at my works computer. So instead I make do with
portable Cygwin.
I was horrified to discover that good old diff.exe is missing from portable Cygwin.
Why is it missing?
Where can I get it from?
What else is missing?
The Baby Cygwin suggestion didn't work - kept getting core dumps.
My solution was to write a wrapper "diff" script in /usr/local/bin, which had something like:
F1=$( cygpath -w $1 )
F1=$( cygpath -w $2 )
/cygdrive/c/Windows/System32/fc.exe ${F1} ${F2}
The output is similar to "diff -c ".
Not ideal. Still no one can tell me why Portable Cygwin is missing this command.
Perhaps you can try my
Baby Cygwin
It has diff.exe
I have a file called commanKT and want to run it in a Linux terminal. Can someone help by giving the command to run this file? I tried ./commonRT but I'm getting the error:
"bash: ./commonrt: cannot execute binary file"
[blackberry#BuildMc MainApp]$ ls -al commonKT
-rwxrwxr-x. 1 sijith sijith 10314053 Feb 27 16:49 commonKT
To execute a binary, use: ./binary_name.
If you get an error:
bash: ./binary_name: cannot execute binary file
it'll be because it was compiled using a tool chain that was for a different target to that which you're attempting to run the binary on.
For example, if you compile 'binary_name.c' with arm-none-linux-gnueabi-gcc and try run the generated binary on an x86 machine, you will get the aforementioned error.
To execute a binary or .run file in Linux from the shell, use the dot forward slash friend
./binary_file_name
and if it fails say because of permissions, you could try this before executing it
chmod +x binary_file_name
# then execute it
./binary_file_name
Hope it helps
The volume it's on is mounted noexec.
:-) If not typo, why are you using ./commonRT instead of ./commonKT ??
It is possible that you compiled your binary with incompatible architecture settings on your build host vs. your execution host.
Can you please have a look at the enabled target settings via
g++ {all-your-build-flags-here} -Q -v --help=target
on your build host? In particular, the COLLECT_GCC_OPTIONS variable may give you valuable debug info. Then have a look at the CPU capabilities on your execution host via
cat /proc/cpuinfo | grep -m1 flags
Look out for mismatches such as -msse4.2 [enabled] on your build host but a missing sse4_2 flag in the CPU capabilities.
If that doesn't help, please provide the output of ldd commonKT on both build and execution host.
This is an answer to #craq :
I just compiled the file from C source and set it to be executable with chmod. There were no warning or error messages from gcc.
I'm a bit surprised that you had to 'set it to executable' -- my gcc always sets the executable flag itself. This suggests to me that gcc didn't expect this to be the final executable file, or that it didn't expect it to be executable on this system.
Now I've tried to just create the object file, like so:
$ gcc -c -o hello hello.c
$ chmod +x hello
(hello.c is a typical "Hello World" program.) But my error message is a bit different:
$ ./hello
bash: ./hello: cannot execute binary file: Exec format error`
On the other hand, this way, the output of the file command is identical to yours:
$ file hello
hello: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
Whereas if I compile correctly, its output is much longer.
$ gcc -o hello hello.c
$ file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=131bb123a67dd3089d23d5aaaa65a79c4c6a0ef7, not stripped
What I am saying is: I suspect it has something to do with the way you compile and link your code. Maybe you can shed some light on how you do that?
The only way that works for me (extracted from here):
chmod a+x name_of_file.bin
Then run it by writing
./name_of_file.bin
If you get a permission error you might have to launch your application with root privileges:
sudo ./name_of_file.bin
Or, the file is of a filetype and/or architecture that you just cannot run with your hardware and/or there is also no fallback binfmt_misc entry to handle the particular format in some other way. Use file(1) to determine.
your compilation option -c makes your compiling just compilation and assembly, but no link.
If it is not a typo, as pointed out earlier, it could be wrong compiler options like compiling 64 bit under 32 bit. It must not be a toolchain.
full path for binary file. For example: /home/vitaliy2034/binary_file_name. Or
use directive "./+binary_file_name".
'./' in unix system it return full path to directory, in which you open terminal(shell).
I hope it helps.
Sorry, for my english language)
1st login with su
su <user-name>
enter password
Password: xxxxxx
Then executer command/file, it should run.
what is the equivalent of dumpstabs -s solaris command in linux?
Regards
ven
I guess this should do the same:
objdump -g
Or maybe
readelf --debug-dump
for ELF files. You can give various options to that last command (see man readelf).
Edit: After reading the manual of objdump, I found the -G option to show the STABS (I guess this is what you want). The manual mentions the following:
This is only useful on systems (such as Solaris 2.0) in which ".stab" debugging symbol-table entries are carried in an ELF section.
So maybe what you want just isn't possible on Linux.