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
Move – ie. Move a file or directory (can also be used to rename)
Remove – ie. Delete a file

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

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  //   /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 -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@

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

More information: