MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

Few useful Linux commands

Published on 02 November 12
588
1
0

Here are few useful unix/linux commands, which any developer needs to know. Hoping all programmers find it handy :-)

#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
Here are few useful unix/linux commands, which any developer needs to know. Hoping all programmers find it handy :-)

#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

This review is listed under Open Source , Development & Implementations and Operating Systems Community

Related Posts:

Unix

 

GNU Linux

 

command

 

shell script

 
View Comment (1)
Post a Comment

Please notify me the replies via email.

Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
  1. 19 November 12
    0

    Thank you, this helped alot.

You may also be interested in
Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top