Sie sind auf Seite 1von 3

1 - S Y S T EM I N F O R M AT I O N 3 - PER F O R M A N C E M O N I TO R IN G A N D S TAT I S T I C S

uname -a # Display Linux s ystem information top # D i s p l a y a n d m a n a ge t h e t o p p r o c e s s e s


uname -r # D i s p l a y ke r n e l r e l e a s e i n f o r m a t i o n htop # I n t e r a c t i v e p r o c e s s v i e w e r ( t o p a l t e r n a t i v e)
c a t /e t c /r e d h a t- r e l e a s e # Show which version of redhat installed mpstat 1 # Display processor related statistics
uptime # Show how long the s ystem has been vmstat 1 # Display vir tual memor y statistics
running + load
iostat 1 # D i s p l a y I /O s t a t i s t i c s
hostname # Show s ystem host name
t a i l 10 0 / v a r/ l o g /m e s s a ge s # D i s p l a y t h e l a s t 10 0 s y s l o g m e s s a ge s ( U s e
hostname - I # Display the IP addresses of the host / v a r/ l o g /s y s l o g f o r D e b i a n b a s e d s y s t e m s .)
last reboot # Show s ystem reboot his tor y tcpdump - i eth0 # C a p t u r e a n d d i s p l a y a l l p a c ke t s o n i n t e r f a c e e t h 0
date # Show the current date and time tcpdump -i eth0 'por t 80' # Monitor all traffic on por t 8 0 ( HT TP )
cal # S h o w t h i s m o n t h' s c a l e n d a r lsof # List all open files on the s ystem
w # Display who is online lsof -u user # List files opened by user
whoami # W h o y o u a r e l o g ge d i n a s free -h # Display free and used memor y ( -h for human
r e a d a b l e , - m f o r M B , - g f o r G B .)
watch df -h # E xe c u t e "d f - h", s h o w i n g p e r i o d i c u p d a t e s

2 - H A R DWA R E IN F O R M AT I O N 4 - USER IN F O R M AT I O N A N D M A N AG EMEN T

dmesg # D i s p l a y m e s s a ge s i n ke r n e l r i n g b u ff e r id # D i s p l a y t h e u s e r a n d g r o u p i d s o f y o u r c u r r e n t u s e r.
c a t /p r o c /c p u i n f o # Display CPU information last # Display th e las t u sers w h o h ave log ged on to th e
s ys tem.
c a t /p r o c /m e m i n f o # Display memor y information
who # Sh ow w h o is log ged in to th e s y s tem.
free -h # Display free and used memor y ( -h for
h u m a n r e a d a b l e , - m f o r M B , - g f o r G B .) w # Sh ow w h o is log ged in an d w h at th ey are doin g.
lspci -t v # Display PCI devices groupadd test # C r e a t e a g r o u p n a m e d " t e s t ".
lsusb -t v # Display USB devices u s e r a d d - c " J o h n S m i t h" # Create an account named john, with a comment
-m john o f " J o h n S m i t h" a n d c r e a t e t h e u s e r ' s h o m e
dmidecode # D i s p l a y D M I / S M B I O S ( h a r d w a r e i n f o) f r o m t h e B I O S d i r e c t o r y.
h d p a r m - i /d e v/s d a # Show info about disk sda userdel john # Delete the john account.
h d p a r m - t T /d e v/s d a # Per form a read speed tes t on disk sda usermod -aG sales john # Add the john account to the sales group
b a d b l o c k s - s /d e v/s d a # Te s t f o r u n r e a d a b l e b l o c k s o n d i s k s d a
5 - F I L E A N D D I R EC TO R Y CO M M A N DS 7 - F IL E PER MI S SI O N S

ls -al # L i s t a l l fi l e s i n a l o n g l i s t i n g (d e t a i l e d ) f o r m a t
pwd # Display the present working direc tor y
m kd i r d i r e c t o r y # Create a direc tor y
rm file # R e m o v e (d e l e t e) fi l e
rm -r direc tor y # Remove the direc tor y and its contents recursively
rm -f file # Force removal of file without prompting for
confirmation
rm -r f direc tor y # Forcefully remove direc tor y recursively
c p fi l e1 fi l e 2 # C o p y fi l e1 t o fi l e 2
cp -r source_direc tor y # Copy source_direc tor y recursively to des tination .
destination If des tination exis t s, copy source_direc tor y into
dest inat ion ,other wise create dest inat ion with the PERMISSION E X AMPLE LEGEND
contents of source_direc tor y
U G W U = User
m v fi l e1 fi l e 2 # R e n a m e o r m o v e fi l e1 t o fi l e 2 . I f fi l e 2 i s a n e x i s t i n g
d i r e c t o r y, m o v e fi m v fi l e1 fi l e 2 l e1 i n t o d i r e c t o r y fi l e 2 . r w x r w x r w x chmod 777 filename # Use sparingly! G = Group
l n - s /p a t h / t o / fi l e # Create s ymbolic l ink to l inkname r w x r w x r-x c h m o d 7 75 fi l e n a m e W = Wo r l d
linkname r w x r-x r-x c h m o d 75 5 fi l e n a m e r = Read
touch file # Create an empt y file or update the access and r w - r w - r- - chmod 664 filename
modific ation times of file. w = write
r w - r- - r- - chmod 64 4 filename x = e xe c u t e
cat file # View the content s of file
less file # Browse through a tex t file - = no access

head file # D i s p l a y t h e fi r s t 10 l i n e s o f fi l e
t ail file # D i s p l a y t h e l a s t 10 l i n e s o f fi l e
8 - N E T WO R K IN G
t ail -f file # D i s p l a y t h e l a s t 10 l i n e s o f fi l e a n d " f o l l o w "
the file as it grows. ifconfig -a # Display all net work inter faces and ip address
ifconfig eth 0 # Display eth 0 address and details
6 - PRO C E S S M A N AG EM EN T ethtool eth 0 # Quer y or control net work driver and hardware
set tings
ps s # Display your currently running processes
ping host # Send ICMP echo reques t to host
ps -ef # Display all the currently running processes
on thes ystem. whois domain # Display whois information for domain

ps - ef | grep processname # Display process information for processname dig domain # Display DNS information for domain

top # D i s p l a y a n d m a n a ge t h e t o p p r o c e s s e s d i g -x I P_ A D D R E S S # R e v e r s e l o o k u p o f I P_ A D D R E S S

htop # I n t e r a c t i v e p r o c e s s v i e w e r ( t o p a l t e r n a t i v e) hos t domain # Display DNS ip address for domain

kill pid # Kill process with process ID of pid hos tname - i # Display the net work address of the host name.

killall processname # Kill all processes named processname hos tname - I # Display all local ip addresses

program & # Star t program in the back ground w ge t h t t p: //d o m a i n .c o m / fi l e # D o w n l o a d h t t p: //d o m a i n .c o m / fi l e

bg # Display s topped or back ground jobs net s t at - nutlp # Display lis tening tcp and udp por ts and

fg # Brings the most recent back ground job to corresponding programs


foreground
fg n # Brings job n to the foreground
9 - A RC H I V E S ( TA R F IL E S ) 12 - S SH LO G IN S

t a r c f a r c h i v e .t a r d i r e c t o r y # C r e a t e t a r n a m e d a r c h i v e .t a r c o n t a i n i n g d i r e c t o r y. s s h h o s t # Co n n e c t t o h o s t a s y o u r l o c a l u s e r n a m e .
t a r x f a r c h i v e .t a r # E x t r a c t t h e c o n t e n t s f r o m a r c h i v e .t a r . ssh user@host # Co n n e c t t o h o s t a s u s e r
t a r c z f a r c h i v e . t a r. g z # Create a gzip compressed tar file name ssh -p por t user@host # Co n n e c t t o h o s t u s i n g p o r t
direc tor y a r c h i v e . t a r. g z .
t a r x z f a r c h i v e . t a r. g z # Ex trac t a gzip compressed tar file.
t a r c j f a r c h i v e . t a r. bz 2 # C r e a t e a t a r fi l e w i t h bz i p 2 c o m p r e s s i o n
direc or y
t a r x j f a r c h i v e . t a r. bz 2 # E x t r a c t a bz i p 2 c o m p r e s s e d t a r fi l e . 13 - F IL E T R A N SF ER S

s c p fi l e .t x t s e r v e r : / t m # S e c u r e c o p y fi l e .t x t t o t h e / t m p f o l d e r o n s e r v e r
s c p s e r v e r : / v a r/ w w w / *. h t m l # Co p y *. h t m l fi l e s f r o m s e r v e r t o t h e l o c a l
/tmp / t m p f o l d e r.
s c p - r s e r v e r : / v a r/ w w w / t m p # Co p y a l l fi l e s a n d d i r e c t o r i e s r e c u r s i v e l y f r o m
s e r v e r t o t h e c u r r e n t s y s t e m' s / t m p f o l d e r.
rsync -a /home /backups/ # Sy n c h r o n i ze / h o m e t o / b a c k u p s / h o m e
10 - IN S TA L L IN G PAC K AG E S
rsync -avz /home # Sy n c h r o n i ze fi l e s /d i r e c t o r i e s b e t w e e n t h e l o c a l
ser ver:/backups/ and remote s ys tem with compression enabled
y u m s e a r c h ke y w o r d # S e a r c h f o r a p a c k a ge b y ke y w o r d .
y u m i n s t a l l p a c k a ge # I n s t a l l p a c k a ge .
y u m i n f o p a c k a ge # Display description and summar y information
a b o u t p a c k a ge .
r p m - i p a c k a ge . r p m # I n s t a l l p a c k a ge f r o m l o c a l fi l e n a m e d p a c k a ge . r p m
14 - D I SK US AG E
y u m r e m o v e p a c k a ge # R e m o v e /u n i n s t a l l p a c k a ge .
df -h # Show free and used space on mounted files ystems
t a r z x v f s o u r c e c o d e .t a r. g z # I n s t a l l s o f t w a r e f r o m s o u r c e c o d e
cd sourcecodE df -i # Show free and used inodes on mounted files ystems
. /c o n fi g u r e
m a ke fdisk -l # D i s p l a y d i s k s p a r t i t i o n s s i ze s a n d t y p e s
m a ke i n s t a l l du -ah # D i s p l a y d i s k u s a ge f o r a l l fi l e s a n d d i r e c t o r i e s i n
human readable format
du -sh # D i s p l a y t o t a l d i s k u s a ge o ff t h e c u r r e n t d i r e c t o r y

11 - SE A RC H 15 - D I R EC TO R Y N AV I G AT I O N
grep pat tern file # Search for pat tern in file cd .. # To go u p o n e l e v e l o f t h e d i r e c t o r y t r e e .
T (C h a n ge i n t o t h e p a r e n t d i r e c t o r y.)
grep -r pat tern direc tor y # Search recursively for pat tern in direc tr y
cd # Go to the $HOME direc tor y
locate name # Find files and direc tories by name
c d /e t c # C h a n ge t o t h e /e t c d i r e c t o r y
find /home/john -name # Find files in /home/john that star t with
'prefix *' " p r e fi x ".
fi n d / h o m e - s i ze +10 0 M # F i n d fi l e s l a r ge r t h a n 10 0 M B i n / h o m e Find more StationX Cheat Sheets here-
https://www.stationx.net/category/cheat-sheets/

Das könnte Ihnen auch gefallen