Skip to main content

Basic Commands for CentOS 7


Basic Configuration


Query or System Locale
localectl
Display the Current Time and Date
date timedatectl
Sync Date and Time
timedatectl
Configure SSH
/etc/ssh/ssh_config
/etc/ssh/sshd_config


Jobs And Services


List all Services
systemctl -at service
ls /etc/systemd/system/*.service
ls /usr/lib/systemd/system/*.service
List Services that are Running
systemctl -t service –state=active
Start and Stop services. Replace <service> with the name of the service
systemctl start <service>
systemctl stop <service>
Enable and Disable Services. Replace <service> with the name of the service
systemctl enable <service>
systemctl disable <service>
Check Service Status. Replace <service> with the service name
systemctl status <service>
 
 
 
 
 
  <service> with the service name
systemctl is-enabled <service>
Configure Logs
/etc/rsyslog.conf
/etc/rsyslog.d/*.conf
View Logs
/var/log journalctl
Find Files
find
Create Archive
tar
cpio

Kernel, Boot, Hardware

Single user Rescue Mode
append rd.break or init=/bin/bash to kernel cmdline
Power Off System
poweroff
systemctl poweroff
Halt System
halt
systemctl halt
Reboot System
reboot
systemctl reboot
Configure GRUB
/etc/default/grub
grub2-mkconfig
grub-set-default
View Kernel Parameters
sysctl -a
cat /proc/cmdline
Load Kernel Module
modprobe
View Kernel Version
rpm -q kernel
uname -r

Software Management

Install Software
yum install
yum group install
View Software Info
yum info
yum group info
Update Software
yum update
Upgrade Software
yum upgrade
Configure Software Repositories
/etc/yum.repos.d/*.repo
Find Package Owning File
rpm -qf filename
yum provides filename-glob
View Software Version
rpm -q packagename
View Installed Software
rpm -qa
yum list installed

User Management

Create User
useradd
Delete User
userdel
View or Change User Details
usermod
/etc/passwd
vipw
id
Create User Group
groupadd
Delete User Group
groupdel
Change Group Details
groupmod
/etc/group
Change User Password
passwd
Change User Permissions
usermod
visudo
Change Group Permissions
groupmod
visudo
Change Password Policy
chage
View User Sessions
w

File Systems, Volumes And Disks

Create / Modify Disk Permissions
fdisk
gdisk
parted
ssm create
Format Disk Partitions
mkswap
Defragment Disk Space
fsck
Mount Storage
mount
/etc/fstab
Mount and Activate Swap
/etc/fstab
swapon -a
View Free Disk Space
df
Check or Repair File System
fsck
Change File Permissions
chmod
chown
chgrp
umask
Change File Attributes
chattr
Change Access Control List
setfacl

Networking

Change Name Resolution
/etc/hosts
/etc/resolv.conf
Configure Hostname
hostnamectl
/etc/hostname
View Network Interface Information
ip addr
teamdctl
bridge
View Routes
ip route
Configure Routes
ip route add
Configure Firewall
firewall-cmd
View Ports / Sockets
ss
lsof

Security And Identity

Configure Security System
/etc/selinux/config chcon
restorecon
semanage
setsebool
LDAP, SSSD
authconfig
authconfig-tui
Network Users
getent

Resource Management

Change Process Priority
nice
renice
Change Process Run Location
taskset
Kill a Process
kill
pkill
View System Usage
top
ps
ss
vmstat
View Disk Usage
df

 

Comments

Popular posts from this blog

What is STP? - Explain Advantages and Disadvantages

The Spanning Tree Protocol is a network protocol that builds a loop-free logical topology for Ethernet networks. The basic function of STP is to prevent bridge loops and the broadcast radiation that results from them. STP is a protocol. It actively monitors all links of the network. To finds a redundant link, it uses an algorithm, known as the STA (spanning-tree algorithm). The STA algorithm first creates a topology database then it finds and disables the redundant links. Once redundant links are disabled, only the STP-chosen links remain active. If a new link is added or an existing link is removed, the STP re-runs the STA algorithm and re-adjusts all links to reflect the change. STP (Spanning Tree Protocol) automatically removes layer 2 switching loops by shutting down the redundant links. A redundant link is an additional link between two switches. A redundant link is usually created for backup purposes. Just like every coin has two sides, a redundant link, along with

What are the Advantages and Disadvantages of TCP/UDP ?? Difference between TCP and UDP

As in previous blog we have define and explain about what is TCP and UDP and from now we are moving ahead with Advantages, Disadvantages and Difference of TCP and UDP but for this you have to know about TCP and UDP hence to understand it go for a What is TCP and UDP . Advantage of TCP Here, are pros/benefits of TCP: It helps you to establish/set up a connection between different types of computers. It operates independently of the operating system. It supports many routing-protocols. It enables the internetworking between the organizations. TCP/IP model has a highly scalable client-server architecture. It can be operated independently. Supports several routing protocols. It can be used to establish a connection between two computers. Disadvantages of TCP Here, are disadvantage of using TCP: TCP never conclude a transmission without all data in motion being explicitly asked. You can't use for broadcast or multicast transmission. TCP has no block boundaries, so you