Here a short list of Linux commands that can be useful:
https://vim.rtorr.com/
List content of a folder with permissions
ls -l
Go to folder usr
cd /usr
Make Directory – ie. Create a directory.
mkdir cognos
Remove Directory – ie. Delete a directory.
rmdir cognos
Create a blank file named index in folder db
touch db/index
Copy – ie. Copy a file or directory
cp
Move – ie. Move a file or directory (can also be used to rename)
mv
Remove – ie. Delete a file
rm
Change permissions so only Root user have access to folder /root/ca
chmod 600 -R /root/ca
Change permission so all have access to file cognos
chmod 777 cognos
Change owner of a file to dockeruser
chown dockeruser: filename
Shutdown a linux server
init 0
Restart of linux server
init 6
Linux command to list groups a user is part of
groups donald
Add a group to a exiting user
usermod -a -G examplegroup exampleusername
Create a new user and add it to a group
useradd -G examplegroup exampleusername
Set a password for the new user
passwd exampleusername
Change to a other user
su – exampleusername
To check if you can find server by DNS
ping servername
To install telnet in a centos distribution
yum install telnet
To check if port 9300 is open to server
telnet servername 9300
List firewall rules in Linux
iptables -L INPUT
Check if port 80 or 443 is open
netstat -ano|grep LISTEN
Add file1 to file2
cat file1.txt >> file2.txt
Change to a parallel folder
cd ../scripts/
Move several pem files to sub folder old
mv *.pem ./old/
Show cpu and memory usage
top
Show Top 7 Memory Consuming Process in Linux
ps -auxf | sort -nr -k 4 | head -7
Shutdown a centos linux server
/sbin/shutdown -h now
Create folder to use to connect to your windows host from a linux vmware image
sudo mkdir /media/source
Install software in centos to allow mount of windows shares
yum install cifs-utils
To connect “install” file share on windows server to above folder in Linux
sudo mount -t cifs -o username:donald,password=duck,vers=2.0 //192.168.254.1/install /media/source
IMPORTANT you need to enter vers=2.0 in some versions of Linux.
Change username and password to a local windows user that have access to the file share.
To extract a file
unzip filename.zip -d destination_folder
Linux command to find ip address of server
/sbin/ifconfig | grep ‘inet’
Connect to other linux machine from linux (putty in windows)
ssh -Y root@192.168.254.90
Set open files limit in Linux — cognos need to have a high value.
ulimit -n 8192
Install support for x – so you can see config
sudo yum install xorg-xll-xauth
Start of cognos configuration from ssh window
./cogconfig.sh
List free space on the hard drive
df -h
Check if you have access to docker compose program by check version
docker-compose version
List all downloaded images
docker image ls
List all running process in docker
docker ps
List all installed process in docker
docker ps –all
Kill a docker process (you need to enter a exact name, no wildcards)
docker kill admintool
Kill all running containers
docker kill $(docker ps -q)
Delete all stopped containers
docker rm $(docker ps -a -q)
Delete all images
docker rmi $(docker images -q)
Show cert file on screen, to check if it is correct
openssl pkcs7 -print_certs -in certnew.p7b
Convert a certificate_chain_file.pfx file to pem format with the following command:
openssl pkcs12 -in c:\temp\your.pfx -out c:\temp\good.pem -nodes
Change keyboard to swedish in Red Hat
localectl status
localectl set-keymap se
More information:
http://www.linuxandubuntu.com/home/some-basic-linux-commands-for-beginners
https://ryanstutorials.net/linuxtutorial/filemanipulation.php
https://www.pluralsight.com/blog/tutorials/linux-add-user-command
https://www.howtogeek.com/50787/add-a-user-to-a-group-or-second-group-on-linux/
https://www.lifewire.com/switch-user-su-command-3887179