Just to let you know, that I mostly use Redhat.
Zipping a folder
$ tar czvf folder_name.tar.gz folder_name
Finding string in all files of folder
$ find . | xargs grep 'your string'
Removing files if rm -fR does not work
$ find . -name '*filename_pattern*' | xargs rm
Killing Linux process by name
$ kill `ps -ef | grep process_name_pattern | grep -v grep | awk '{print $2}'`
Linux command for find and replace
$ sed 's#FIND_STRING#REPLACE_STRING#g' File_Name > New_File_Name
Datetime update cron
Type crontab –e as su (super user) and paste following, replace your_datetime_server with IP or name of your server.
5 0 * * * /usr/sbin/ntpdate your_datetime_server > /dev/null 2>&1
Disk space usage in a folder
Change directory to your server and type
$ du -ks -h *
Find and remove files 14 days old
$ find /folder_name/ *file_name_pattern* -atime +14 -print | xargs rm
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment