Wednesday, June 14, 2017

Basic Linux commands

Find out linux version

more /etc/*-release

How long the server is up?
uptime

How many cpus I have ?
lscpu

Last system reboot
who -b

Log off
Ctrl + d

print working directory
pwd

Change to home
cd $home

Create a directory
mkdir name
mkdir -p xx/yy/zz

Remove direcotry
rmidr name

List Directory
ls
ls -l  (long format)

Deleting files
rm filename
rm -i source/report.cpp
rm -r *  -- delete all the files

Process
ps -a 

kill processid

Grep

You can use the grep command to search for a specified pattern in a file or list of files.
The pattern used by the grep command is called regular expression, hence the strange
name of the command (Global Regular Expression Print).

$cat myfile
$grep WORK myfile

touch newfile -d 

CPU usage
top

Basic File Management
cp - copy
dd -image
mv - move and rename
rm - remove
ls - list

Remote Login
ssh -l root
ssh servername

Linux Performance

rpm –ql procps-ng

rpm – redhat package manager
ql – query list
proc ps  -ng (next generation)

rpm –ql  /usr/bin/top

What programs are available in user ?
rpm –ql procps-ng | grep  ‘^/usr/bin/’

Go to the process
cd /proc

Find my process
pwdx $$

Go to my process
cd /proc/$$





No comments:

Post a Comment

How to add a Database to AlwaysOn Availability Group with four different options

To add a database to an existing AlwaysOn availability group, MS has given us four options to choose from Automatic seeding Full database an...