How can I check if ncurses is installed in a Red-Hat Linux OS? One solution is to use
dpkg -l '*ncurses*' | grep '^ii'
But I don't even have the dpkg package in my system, and since I don't have the administrative rights, I can't install it.
On RedHat based systems there is (mostly) no dpkg but you can use rpm -qa | grep ncurse
on mac:
prompt> ls -la /usr/include/ncurses.h
lrwxr-xr-x 1 root wheel 8 11 jul 14:24 /usr/include/ncurses.h -> curses.h
The second line being not empty, this means ncurses is installed.
Related
I uninstalled accidentally python3.10 using rm -rf python3.10 in /usr/bin my terminal is not working anymore
but can access through VSCode but it say
any suggestion? thank you in advanced
It is because /usr/bin/python3 is a soft link to /usr/bin/python3.10 which is the main binary that runs python3 on your machine.
This should help :
$ ls -l /usr/bin/python3
lrwxrwxrwx 1 root root 10 May 31 13:02 /usr/bin/python3 -> python3.10
You might need to install python again to get the binary.
If you have different version of python available that you want to use, create link to it like this:
ln -s file1 link1
which would be in case you have python3.10 re/installed
ln -s /usr/bin/python3.10 /usr/bin/python3
Considering you deleted python3.10 binary by mistake!
I try to use an executable script (wkhtmltopdf) on a Linux shared webserver (Debian, 64bit). I am pretty sure that I compiled everything correct, but whenever I want to execute the file I get as an response :
> ./wkhtmltopdf -H
-bash: ./wkhtmltopdf: No such file or directory
To be sure that the file is there, here the ls output :
> ls
wkhtmltoimage wkhtmltopdf
Furthermore I tested the file command on it, which outputs the following :
> file wkhtmltopdf
wkhtmltopdf: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
My question is now :
Why does bash tells me that there is no 'file or directory', when there obviously is one?
My first guess would be that the shared server does not allow to execute binary files? But shouldn't it then be a problem of permissions, with a different bash output?
Edit :
> id
uid=2725674(p8907906) gid=600(ftpusers) groups=600(ftpusers)
> ls -l wkhtmltopdf
-rwxrwxrwx 1 p8907906 ftpusers 39745960 Jan 20 09:33 wkhtmltopdf
> ls -ld
drwx---r-x 2 p8907906 ftpusers 44 Jan 28 21:02 .
I bet you miss dynamic linker. Just do a
readelf --all ./wkhtmltopdf | grep interpreter
You should get an output like this:
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
There are high chances that you system lacks the interpreter (/lib64/ld-linux-x86-64.so.2 in the example). In this case bash would yell No such file or directory, just like when the binary itself is missing.
You can try to use a different linker. Sometime you can succeed. Just do a:
/path/to/the/linker /path/to/your/executable
This command:
find /lib* -name ld-linux\*
will help you find the linkers on your system. Or you can do the readelf command on some command that does run. It will show you correct, working linker.
OR, since you are running Debian system, just do a
sudo apt-get install wkhtmltopdf
to install native version of the tool :)
In my case
$ readelf --all ./wkhtmltopdf | grep interpreter # readelf: Displays information about ELF files.
[Requesting program interpreter: /lib/ld-linux.so.2]
On a machine where the executable was working:
$ ls -lah /lib/ld-linux.so.2
lrwxrwxrwx 1 root root 25 Apr 16 2018 /lib/ld-linux.so.2 -> i386-linux-gnu/ld-2.27.so
$ dpkg -S /lib/ld-linux.so.2 # -S, --search filename-search-pattern: Search for a filename from installed packages.
libc6:i386: /lib/ld-linux.so.2
So to fix the problem (reference)
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386 # GNU C Library: Shared libraries (from apt show)
Missing the linker was my case as well. I could fix it with the help of nsilent22 answer like this:
readelf --all /usr/local/myprogram | grep interpreter
[Requesting program interpreter: /lib64/ld-lsb-x86-64.so.3]
But that linker did not exist anymore.
The old situation in /lib64 was:
ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.31.so
ld-linux-x86-64.so.3 -> ld-linux-x86-64.so.2
So it turned out this was just a symlink to the systems' linker.
Moving over to /lib64 , which itself is a symlink to usr/lib64 and creating a symlink over there did not work. I assume that there are to many symbolic link levels after Debian moved everything into /usr
However creating a 'direct' symlink
ln -s /usr/lib64/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3
did the job; /usr/lib64 now shows:
ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.31.so
ld-lsb-x86-64.so.3 -> /usr/lib64/ld-linux-x86-64.so.2
I ran into this issue on my raspberry pi 4 running aarch64 alpine 3.13. Using the answer provided by #vkersten, I was able to determine that I was missing /lib/ld-linux-aarch64.so.1.
I resolved this by installing gcompat with apk add gcompat.
In Linux (Fedora), how I see all the installed packages which contain a certain words in the package name. Then, remove all these packages installed.
Assuming you are using a debian-based Linux (like Ubuntu or Mint, for example), you can do like this to search for mysq:
dpkg -l | grep mysq
and to get only the names
dpkg -l | grep mysq | awk '{print $2}'
if you want remove all packages, containing a specific word, you don't need to pipe lists through grep or whatever. Just type
$ sudo yum remove "*word*"
If you want to review list of such packages before removing, then type
$ rpm -qa "*word*"
That's it.
Fedora is an RPM-based distribution. So you'll want to use the rpm or yum commands.
To list installed: yum list installed | grep <name> or rpm -a | grep <name>
To remove a package: rpm -e <package-name> or yum remove <package-name>
Sources:
Fedora RPM Guide
Fedora yum wiki
in linux, you can install programs in a variety of places. Most of the time, your rpm on your distro is responsible for removing all of the bits and pieces of a program. One solution, although this is fraught with danger, is to grep your usr/bin like this:
ls /usr/bin || grep 'some package name'
and pipe that to an rm-rf ... 'shuddurs'
A safer bet though is to just use apt-get uninstall 'someApp' much safter
I need a script that will check whether packages are installed for apache2, mysql and php.
Example output:
apache2 .... ok
mysql .... ok
php ... not installed
Packages are not necessarily named the same on different distributions, and querying for their presence depends on the package manager in use.
Debian (dpkg):
dpkg-query -W -f='${Package}\n' apache2 mysql-server php5 2>/dev/null
Fedora (RPM):
rpm -q --qf '%{NAME}\n' httpd mysql-server php 2>/dev/null
Gentoo (Portage):
equery --quiet list www-servers/apache:2 dev-lang/php dev-db/mysql
Assuming APT:
dpkg -l | grep -i apache2
etc.
For CentOS (will only show the ones that are installed):
yum list installed | egrep -i 'apache|mysql|php'
sudo find /etc | xargs grep -i fedora > searchFedora
gives:
/etc/netplug.d/netplug: # At least on Fedora Core 1
...
But see the Fedora version in the /etc/netplug.d/netplug file. Is it serious?
cat /etc/issue
Or cat /etc/fedora-release as suggested by #Bruce ONeel
You can also try /etc/redhat-release or /etc/fedora-release:
cat /etc/fedora-release
Fedora release 7 (Moonshine)
The proposed standard file is /etc/os-release. See http://www.freedesktop.org/software/systemd/man/os-release.html
You can execute something like:
$ source /etc/os-release
$ echo $ID
fedora
$ echo $VERSION_ID
17
$ echo $VERSION
17 (Beefy Miracle)
The simplest command which can give you what you need but some other good info too is:
hostnamectl
You could try
lsb_release -a
which works on at least Debian and Ubuntu (and since it's LSB, it should surely be on most of the other mainstream distros at least). http://rpmfind.net/linux/RPM/sourceforge/l/ls/lsb/lsb_release-1.0-1.i386.html suggests it's been around quite a while.
cat /etc/*release
It's universal for almost any major distribution.
[Belmiro#HP-550 ~]$ uname -a
Linux HP-550 2.6.30.10-105.2.23.fc11.x86_64 #1 SMP Thu Feb 11 07:06:34 UTC 2010
x86_64 x86_64 x86_64 GNU/Linux
[Belmiro#HP-550 ~]$ lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:deskt
op-3.1-amd64:desktop-3.1-noarch:desktop-3.2-amd64:desktop-3.2-noarch
Distributor ID: Fedora
Description: Fedora release 11 (Leonidas)
Release: 11
Codename: Leonidas
[Belmiro#HP-550 ~]$
These commands worked for Artik 10 :
cat /etc/fedora-release
cat /etc/issue
hostnamectl
and these others didn't :
lsb_release -a
uname -a
What about uname -a ?
On my installation of Fedora 25 (workstation) all of the distribution ID info was found in this file:
/usr/lib/os.release.d/os-release-workstation
This included,
NAME=Fedora
VERSION="25 (Workstation Edition)"
ID=fedora
VERSION_ID=25
PRETTY_NAME="Fedora 25 (Workstation Edition)"
<...>
VARIANT="Workstation Edition"
VARIANT_ID=workstation
You can simply run this command to get the version number:
rpm -E %fedora
output:
uname -a works with my fc11
use commmand , screenfetch
output format info.