Linux commands

Here a short list of Linux commands that can be useful:
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 folder cognos
chmod 777 cognos

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

Add file1 to file2
cat file1.txt >> file2.txt

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

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