rpm -ql <package>
Category: Linux
Check package version using rpm
rpm -qa *intel*
rpm -qa | sort | grep intel
Batch process all files in a folder
#!/bin/bash
for file in <path>/*; do
dcm2pnm "$file" "$file".png --write-png
done
Count the number of files in a directory
ls -l | wc -l
wc: word count
Check Linux OS version
cat /etc/os-release
Search installed packages using rpm
rpm -qa --last | grep <something>
Check where python packages are installed in a docker
Usually here:
/usr/local/lib/<python version>/site-packages
Or
pip show request <package name>
Check libraries related to a binary
ldd /usr/local/bin/<name>* | grep <something>
Solution to “Another app is currently holding the yum lock; waiting for it to exit”
cat /var/run/yum.pid
<pid>
kill -9 <pid>
To get more details, use
ps -p <pid>
or
ps -ef | grep <pid>
Delete files owned by a specific user on Linux
Delete all txt files:
find ~/testFolder/*.txt -user @USERNAME -exec rm {} \;
Note, the semicolon is necessary.
Delte all files and directories:
find ~/testFolder/ -user @USERNAME -exec rm -rf {} \;
But be careful using “-rf”.