Sunteți pe pagina 1din 27

Install Cacti (Network Monitoring) on

RHEL/CentOS 7.x/6.x/5.x and Fedora 21-12


Install Wine 1.6.2 Stable in RHEL/CentOS
7.0/6.x/5.x and Fedora 20-12
CentOS 6.4 Step by Step Installation Guide with
Screenshots

30 Useful Linux System Administration Commands

1. Uptime Command
In Linux uptime command shows since how long your system
is running and the number of users are currently logged in and
also displays load average for 1,5 and 15 minutes intervals.

DOWNLOAD FREE LINUX EBOOKS


Complete Linux Command Line Cheat Sheet
The GNU/Linux Advanced Administration Guide
Securing & Optimizing Linux Servers
Linux Patch Management: Keeping Linux Up To
Date
Introduction to Linux A Hands on Guide
Understanding the Linux Virtual Memory

#uptime
08:16:26up22min,1user,loadaverage:0.00,0
.03,0.22

Manager
Linux Bible Packed with Updates and Exercises
A Newbies Getting Started Guide to Linux
Linux from Scratch Create Your Own Linux OS
Linux Shell Scripting Cookbook, Second Edition

Check Uptime Version


Uptime command dont have other options other than uptime

Securing & Optimizing Linux: The Hacking


Solution
User Mode Linux Understanding and
Administration

and version. It gives information only in hours:mins if it less


than 1 day.

[tecmint@tecmint~]$uptimeV
procpsversion3.2.8

2. W Command
It will displays users currently logged in and their process
along-with shows load averages. also shows the login name,
tty name, remote host, login time, idle time, JCPU, PCPU,
command and processes.

#w
08:27:44up34min,1user,loadaverage:0.00,0
.00,0.08
USERTTYFROMLOGIN@IDLE
JCPUPCPUWHAT
tecmintpts/0192.168.50.107:590.00s
0.29s0.09sw

Available options

-h : displays no header entries.


-s : without JCPU and PCPU.
-f : Removes from field.
-V : (upper letter) Shows versions.

3. Users Command
Users command displays currently logged in users. This
command dont have other parameters other than help and
version.

#users
tecmint

4. Who Command
who command simply return user name, date, time and host
information. who command is similar to w command. Unlike w
command who doesnt print what users are doing. Lets
illustrate and see the different between who and w commands.

#who
tecmintpts/02012091807:59(192.168.50.

1)

#w
08:43:58up50min,1user,loadaverage:0.64,0
.18,0.06
USERTTYFROMLOGIN@IDLE
JCPUPCPUWHAT
tecmintpts/0192.168.50.107:590.00s
0.43s0.10sw

Who command Options


-b : Displays last system reboot date and time.
-r : Shows current runlet.
-a, all : Displays all information in cumulatively.

5. Whoami Command
whoami command print the name of current user. You can also
use who am i command to display the current user. If you are
logged in as a root using sudo command whoami command
return root as current user. Use who am i command if you
want to know the exact user logged in.

#whoami

tecmint

6. ls Command
ls command display list of files in human readable format.

#lsl
total114
drxrxrx.2rootroot4096Sep1808:46bin
drxrxrx.5rootroot1024Sep815:49boot

Sort file as per last modified time.

#lsltr
total40
rwrr.1rootroot6546Sep1718:42install.
log.syslog
rwrr.1rootroot22435Sep1718:45install.
log
rw.1rootroot1003Sep1718:45anaconda
ks.cfg

For more examples of ls command, please check out our

article on 15 Basic ls Command Examples in Linux.

7. Crontab Command
List schedule jobs for current user with crontab command and
-l option.

#crontabl
0010***/bin/ls>/ls.txt

Edit your crontab with -e option. In the below example will open
schedule jobs in VI editor. Make a necessary changes and quit
pressing :wq keys which saves the setting automatically.

#crontabe

For more examples of Linux Cron Command, please read our


earlier article on 11 Cron Scheduling Task Examples in Linux.

8. Less Command
less command allows quickly view file. You can page up and
down. Press q to quit from less window.

#lessinstall.log
Installingsetup2.8.1410.el6.noarch
warning:setup2.8.1410.el6.noarch:HeaderV3RSA/
SHA256Signature,keyIDc105b9de:NOKEY
Installingfilesystem2.4.302.1.el6.i686
Installingcacertificates2010.633.el6.noarch
Installingxmlcommon0.6.332.el6.noarch
Installingtzdata2010l1.el6.noarch
Installingisocodes3.162.el6.noarch

9. More Command
more command allows quickly view file and shows details in
percentage. You can page up and down. Press q to quit out
from more window.

#moreinstall.log
Installingsetup2.8.1410.el6.noarch
warning:setup2.8.1410.el6.noarch:HeaderV3RSA/
SHA256Signature,keyIDc105b9de:NOKEY
Installingfilesystem2.4.302.1.el6.i686
Installingcacertificates2010.633.el6.noarch
Installingxmlcommon0.6.332.el6.noarch
Installingtzdata2010l1.el6.noarch
Installingisocodes3.162.el6.noarch
More(10%)

10. CP Command
Copy file from source to destination preserving same mode.

#cppfileAfileB

You will be prompted before overwrite to file.

#cpifileAfileB

11. MV Command
Rename fileA to fileB. -i options prompt before overwrite. Ask
for confirmation if exist already.

#mvifileAfileB

12. Cat Command


cat command used to view multiple file at the same time.

#catfileAfileB

You combine more and less command with cat command to


view file contain if that doesnt fit in single screen / page.

#catinstall.log|less
#catinstall.log|more

For more examples of Linux cat command read our article on


13 Basic Cat Command Examples in Linux.

13. Cd command (change directory)


with cd command (change directory) it will goes to fileA
directory.

#cd/fileA

14. pwd command (print working


directory)
pwd command return with present working directory.

#pwd
/root

15. Sort command


Sorting lines of text files in ascending order. with -r options will
sort in descending order.

#sortfileA.txt
#sortrfileA.txt

16. VI Command
Vi is a most popular text editor available most of the UNIX-like
OS. Below examples open file in read only with -R option. Press
:q to quit from vi window.

#viR/etc/shadows

17. SSH Command (Secure Shell)


SSH command is used to login into remote host. For example

the below ssh command will connect to remote host


(192.168.50.2) using user as narad.

#sshnarad@192.168.50.2

To check the version of ssh use option -V (uppercase) shows


version of ssh.

#sshV
OpenSSH_5.3p1,OpenSSL1.0.0fips29Mar2010

18. Ftp or sftp Command


ftp or sftp command is used to connect to remote ftp host. ftp
is (file transfer protocol) and sftp is (secure file transfer
protocol). For example the below commands will connect to
ftp host (192.168.50.2).

#ftp192.168.50.2
#sftp192.168.50.2

Putting multiple files in remote host with mput similarly we can


do mget to download multiple files from remote host.

#ftp>mput*.txt
#ftp>mget*.txt

19. Service Command


Service command call script located at /etc/init.d/ directory
and execute the script. There are two ways to start the any
service. For example we start the service called httpd with
service command.

#servicehttpdstart
OR
#/etc/init.d/httpdstart

20. Free command


Free command shows free, total and swap memory
information in bytes.

#free

totalusedfreeshared
bufferscached
Mem:10308007359442948560
51648547696
/+buffers/cache:136600894200
Swap:206437602064376

Free with -t options shows total memory used and available to


use in bytes.

#freet
totalusedfreeshared
bufferscached
Mem:10308007360962947040
51720547704
/+buffers/cache:136672894128
Swap:206437602064376
Total:30951767360962359080

21. Top Command


top command displays processor activity of your system and
also displays tasks managed by kernel in real-time. Itll show
processor and memory are being used. Use top command with
u option this will display specific User process details as
shown below. Press O (uppercase letter) to sort as per
desired by you. Press q to quit from top screen.

#toputecmint
top11:13:11up3:19,2users,loadaverage:0
.00,0.00,0.00
Tasks:116total,1running,115sleeping,0st
opped,0zombie
Cpu(s):0.0%us,0.3%sy,0.0%ni,99.7%id,0.0%wa
,0.0%hi,0.0%si,0.0%st
Mem:1030800ktotal,736188kused,294612kfr
ee,51760kbuffers
Swap:2064376ktotal,0kused,2064376kfr
ee,547704kcached
PIDUSERPRNIVIRTRESSHRS%CPU%MEM
TIME+COMMAND
1889tecmint200114681648920S0.00.2
0:00.59sshd
1890tecmint200512416681416S0.00.2
0:00.44bash
6698tecmint200116001668924S0.00.2
0:01.19sshd
6699tecmint200512415961352S0.00.2
0:00.11bash

For more about top command weve already compiled a list of


12 TOP Command Examples in Linux.

22. Tar Command


tar command is used to compress files and folders in Linux.
For example the below command will create a archive for

/home directory with file name as archive-name.tar.

#tarcvfarchivename.tar/home

Introduction to Linux - A Hands on Guide - Free eBook

Download Now

To extract tar archive file use the option as follows.

#tarxvfarchivename.tar

To understand more about tar command weve created a


complete how-to guide on tar command at 18 Tar Command
Examples in Linux.

23. Grep Command


grep search for a given string in a file. Only tecmint user
displays from /etc/passwd file. we can use -i option for
ignoring case sensitive.

#greptecmint/etc/passwd
tecmint:x:500:500::/home/tecmint:/bin/bash

JoinOver95000+LinuxUsers
SHARE
57,739

114

3,201

25,639

Enter your email to get latest Linux Howto's

24. Find Command

Enter Your Email Address :)

1.2k

20 Linux YUM (Yellowdog Updater, Modified) Commands

Find command used to search files, strings and directories.

The below example of find command search tecmint word in /


partition and return the output.

149

#find/nametecmint
/var/spool/mail/tecmint
/home/tecmint
/root/home/tecmint

38

58

For complete guide on Linux find command examples fount at


35 Practical Examples of Linux Find Command.

25. lsof Command


lsof mean List of all open files. Below lsof command list of all
opened files by user tecmint.

#lsofutecmint
COMMANDPIDUSERFDTYPEDEVICESIZE/OF
FNODENAME
sshd1889tecmintcwdDIR253,0409
62/
sshd1889tecminttxtREG253,053233

COMMENTS

Subscribe

6298069/usr/sbin/sshd
sshd1889tecmintDELREG253,0
412940/lib/libcom_err.so.2.1
sshd1889tecmintDELREG253,0
393156/lib/ld2.12.so
sshd1889tecmintDELREG253,0
298643/usr/lib/libcrypto.so.1.0.0
sshd1889tecmintDELREG253,0
393173/lib/libnsl2.12.so
sshd1889tecmintDELREG253,0
412937/lib/libkrb5support.so.0.1
sshd1889tecmintDELREG253,0
412961/lib/libplc4.so

For more lsof command examples visit 10 lsof Command


Examples in Linux.

26. last command


With last command we can watch users activity in the system.
This command can execute normal user also. It will display
complete users info like terminal, time, date, system reboot or
boot and kernel version. Useful command to troubleshoot.

#last
tecmintpts/1192.168.50.1TueSep180
8:50stillloggedin
tecmintpts/0192.168.50.1TueSep180

7:59stillloggedin
rebootsystemboot2.6.32279.el6.iTueSep180
7:5411:38(03:43)
rootpts/1192.168.50.1SunSep161
0:40down(03:53)
rootpts/0:0.0SunSep161
0:3613:09(02:32)
roottty1:0SunSep161
0:07down(04:26)
rebootsystemboot2.6.32279.el6.iSunSep160
9:5714:33(04:35)
naradpts/2192.168.50.1ThuSep130
8:07down(01:15)

You can use last with username to know for specific users
activity as shown below.

#lasttecmint
tecmintpts/1192.168.50.1TueSep180
8:50stillloggedin
tecmintpts/0192.168.50.1TueSep180
7:59stillloggedin
tecmintpts/1192.168.50.1ThuSep130
8:07down(01:15)
tecmintpts/4192.168.50.1WedSep121
0:1212:29(02:17)

27. ps command

ps command displays about processes running in the system.


Below example show init process only.

#psef|grepinit
root10007:53?00:00:04/sb
in/init
root75086825011:48pts/100:00:00gre
pinit

28. kill command


Use kill command to terminate process. First find process id
with ps command as shown below and kill process with kill -9
command.

#psef|grepinit
root10007:53?00:00:04/sb
in/init
root75086825011:48pts/100:00:00gre
pinit
#kill97508

29. rm command

rm command used to remove or delete a file without prompting


for confirmation.

#rmfilename

Using -i option to get confirmation before removing it. Using


options -r and -f will remove the file forcefully without
confirmation.

#rmitest.txt
rm:removeregularfile`test.txt'?

30. mkdir command example.


mkdir command is used to create directories under Linux.

#mkdirdirectoryname

This is a handy day to day useable basic commands in Linux /


Unix-like operating system. Kindly share through our comment
box if we missed out.

If you have any questions or problems regarding this article and


want help within 24 Hours? Ask Now
Support TecMint: Did you find this tutorial helpful?. Please help to keep it alive
by donating. Every cent counts! - Donate Now

Ravi Saive

View all Posts

Simple Word a Computer Geek and Linux Guru who loves


to share tricks and tips on Internet. Most Of My Servers runs on Open
Source Platform called Linux.

Your name can also be listed here. Got a tip? Submit it


here to become an TecMint author.
Receive Your Free Complimentary eBook NOW! - Can You Run It On Linux?
10 Vital Apps You Will Want When You Switch

Download Free Linux eBooks

PREVIOUS STORY

NEXT STORY

Install VLC 2.0.5 in Ubuntu 12.10

Simple Steps to Upgrade Linux

and Linux Mint 14

Mint 13 (Maya) to Linux Mint 14

(Nadia)

YOU MAY ALSO LIKE...


16

10 sFTP Command
Examples to Transfer

7 Quirky ls Command
Tricks Every Linux User

44

Rename A Command
Line Tool For Renaming

Files on Remote
Servers in Linux

Should Know

Multiple Files in Linux

23 MAR, 2015

10 OCT, 2013

6 FEB, 2014

58 RESPONSES
Comments 58
Yoander

Pingbacks 0

October 26, 2015 at 8:20 pm

Another useful commands: arch, dmidecode


Reply
madhavakalikivayi

October 16, 2015 at 11:33 pm

Its useful information


Reply
Madhu Prasad

October 9, 2015 at 4:50 pm

great post very useful information.


Reply
sunil verma

February 27, 2015 at 11:20 pm

i want to share my knowledge to the people because i want all people grow fast
in their life
Reply
Ravi Saive

March 2, 2015 at 12:26 pm

@Sunil,
what kind of knowledge you want to share with the people? can you brief
us..

Reply
Tomas

November 2, 2014 at 4:15 pm

This article is about useful commands for SYSADMINS and has no mention of
rsync? Seriously? :)
Reply
Ateeq

October 21, 2014 at 12:50 am

Hi,
I have a basic knowledge on Linux and Unix server. Want to enhance my
knowledge fully and become a Unix Admin or Linux Engineer. Could someone
please refer me the best book which is available in India Bangalore( Indian author
is better)
Reply
GrimReaper

November 2, 2014 at 5:30 am

There are enough low wage Indians thinking they know how to administer
Unix systems. Yet there foreign masters do not trust them to execute any
command without prior approval. I witnessed this scenario many times
while waiting for the Indian to call the manager at the client for approval.
Besides you can find the titles of a plethora of Unix administration books
via any Internet search engine.
Reply

Older Comments

LEAVE A REPLY
Name *

Email *

Website

Comment

Post Comment

LINUX MONITORING TOOLS

LINUX INTERVIEW QUESTIONS

Monitor Server Logs in Real-Time with


Log.io Tool on RHEL/CentOS 7/6

10 Useful Interview Questions and


Answers on Linux Shell Scripting

28 OCT, 2014

26 MAY, 2014

How to Install vnStat and vnStati to


Monitor Network Traffic in
RHEL/CentOS 7
4 APR, 2015

OPEN SOURCE TOOLS

Is Linux Operating System Virus Free?


1 AUG, 2013

10 Interview Questions and Answers on


Various Commands in Linux

Install GLPI (IT and Asset


Management) Tool with Fusion
Inventory in Debian Linux

22 MAR, 2014

13 MAY, 2015

Mytop (MySQL Database Monitoring) in


RHEL/CentOS 6.3/5.6 and Fedora
17/12
8 NOV, 2012

How to Limit the Network Bandwidth


Used by Applications in a Linux System
with Trickle

10 Useful SSH (Secure Shell) Interview


Questions and Answers
15 MAR, 2014

Create Your Own Instant


Messaging/Chat Server Using
Openfire in Linux
27 DEC, 2013

11 Advance MySQL Database


Interview Questions and Answers for
Linux Users

Wireshark Network Protocol Analyzer


Tool for RHEL/CentOS/Fedora

17 JUN, 2014

16 AUG, 2012

25 FEB, 2015

Tecmint: Linux Howtos, Tutorials & Guides 2015. All Rights Reserved.
This work is licensed under a (cc) BY-NC
The material in this site cannot be republished either online or offline,
without our permission.

S-ar putea să vă placă și