0% found this document useful (0 votes)
7 views1 page

Mrinflictor Centos

The document provides a cheat sheet for CentOS with summaries of I/O redirection, Bash shortcuts, archiving, scheduling with cron, file management, useful snippets, file paths, and iptables commands. It includes examples for compressing and extracting files using tar and gzip, searching files, and network configuration files.

Uploaded by

Pas DEN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Mrinflictor Centos

The document provides a cheat sheet for CentOS with summaries of I/O redirection, Bash shortcuts, archiving, scheduling with cron, file management, useful snippets, file paths, and iptables commands. It includes examples for compressing and extracting files using tar and gzip, searching files, and network configuration files.

Uploaded by

Pas DEN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CentOS Cheat Sheet

by mrinflictor via cheatography.com/19277/cs/2334/

I/O Redire​ction Bash Shortcuts Archiving

> Redirect STDOUT to a file CTRL-c Kill current command # compress (tar/gzip)

2> Redirect STERR to a file CTRL-a Goto start of current line tar cvzf <fi​le>.tgz <di​rec​tor​y>
# extract (tar/gzip)
&> Redirect all output to a file CTRL-e Goto end of current line
tar xvzf <fi​le>.tgz
2>&1 Redirect all output to a pipe CTRL-r Search history
# compress (tar/bzip)
cmd1 | cmd2 Pipe STDOUT of cmd1 to cmd2 !! Repeat last command
tar cvjf <fi​le>.tbz <di​rec​tor​y>
Use >> to append rather than overwrite ^abc^def Run previous command, replacing
# extract (tar/bzip)
abc with def
tar xvjf <fi​le>.tbz
Scheduling with cron
# extract (gzip)
Useful Snippets
#list current entries in crontab gunzip <fi​le>.gzip
crontab -l #hostname

#remove current entries in crontab Displays FQDN of system Screen shortcuts


crontab -r #uname -a CTRL-a c Create a new screen session
#edit existing entries in crontab Displays current kernel version CTRL-a n Goto the next screen session
crontab -e
#df -h CTRL-a p Goto the previous screen session
#format
Display partit​ions, sizes details, and mount CTRL-a " Present a list of all sessions
<mi​nut​e> <ho​ur> <day of month>
points
<mo​nth> <day of week> <co​mma​nd> CTRL-a d Detach screen from terminal
#chconfig --list CTRL-a k Kill current session
File Management Displays all services and their status at
screen -r to reattach to a detached session
each runlevel
find / - Find all files named tofind
name iptables
tofind File Paths
#iptables -L
find / - Find all files modified less than 10 /var/named
Displays ruleset of iptables
mmin minutes ago Bind zone files
10 #iptables -I INPUT -p tcp -m tcp -s
/etc/n​ame​d.conf 192.16​8.1​5.2​54/26 --dport 22 -j ACCEPT
grep -i Search input for lines containing
Bind config​uration file Accepts incoming SSH connec​tions from IP
STRING STRING (nocase)
/etc/h​ttp​d/c​onf​/ht​tpd.conf range 192.16​8.1​5.2​54/26
grep -C Search input for lines containing
2 STRING and showing 2 lines before Main apache config​uration file #iptables -I INPUT -s "​192.16​8.1​0.0​/24​" -j
STRING and after DROP
/var/l​og/​httpd/
grep -v Search input for lines NOT Drops all traffic from IP range
Default location for logs
STRING containing STRING 192.16​8.1​0.0/24

grep -c Search input for number of lines /etc/hosts


#iptables -A INPUT -p tcp --dport 25 -j DROP
STRING containing STRING System hosts file
Blocks all traffic to TCP port 25
/etc/r​eso​lv.conf
#/etc/​ini​t.d​/ip​tables save
DNS lookup config​uration file
Saves all IPtables rules and re-applies them
/etc/s​ysc​onf​ig/​network after a reboot

Networ​k/h​ostname config​uration file

/etc/s​ysc​onf​ig/​net​wor​k-s​cripts/

Default location of a network setting file

By mrinflictor Published 14th July, 2014. Sponsored by Readability-Score.com


cheatography.com/mrinflictor/ Last updated 18th July, 2014. Measure your website readability!
Page 1 of 1. https://readability-score.com

You might also like