find all files changed three days ago
find . -ctime -3
find . -ctime +0 -a -ctime -3
to create an empty file use the editor
vi /path/filename
remove a file:
rm /path/filename
remove a whole directory:
rm -r /path/filename
copy a file
cp /pathfrom/filename /pathto/filename
move or rename a file or directory
mv /pathfrom/filename /pathto/filename
change directory
cd /path
go back one directory
cd ..
create a user:
useradd -d /usr/share/nginx/html -s /usr/sbin/nologin USERNAME
check if a group exists:
grep GROUPNAME /etc/group
create a group:
groupadd GROUPNAME
add a user to a group:
usermod -a -G GROUPNAME USERNAME
check user groups:
id USERNAME
make a directory
mkdir /path/directory
change file or directory permissions
chmod 755 filepath
chmod u+rw-x filepath
give permissions to user for /path/file
chown user:group /path/file
give permissions to /path/directory for all files in that directory
chown -R user /path/directory
view content of a file
cat path/filename
more linux commands and what they used for
find a string in a file:
open to the directory you want to search:
cd /path
then type:
grep -r -i STRING_TO_SEARCH_FOR ./
more informations on default ports
what's the path of the folder, i'm into right now, type:
pwd
CENTOS COMMANDS
cent os list installed packages
rpm -qa | less
then press "q" to quit
reboot server
reboot
find the version of installed kernel
uname -r
make sure a program gets started when server (re-)boots
chkconfig --add mysqld
or with set levels
chkconfig --levels 235 mysqld on
check runlevels
chkconfig --list
find a file
locate filename
find a file in a folder
locate filename | grep /foldername
if you did not update the files database for a while do
updatedb
check which software is listening to ports
nmap -v -sT localhost