Some Handy Linux Commands
October 31, 2007
Here are some commands I use ALL THE TIME when working on a web server through SSH. I'll try to update it as I think of other stuff that comes in handy.
Create Tarball
This will create an archive of "folder_name" called "folder_name.tar.gz".tar -czpf folder_name.tar.gz folder_name
Recursively Find a String Within Files
This will find all occurances of "something" within all HTML files. Prints the results in the terminalfind ./ -name '*.html' -exec grep "breadcrumbs.inc.php" '{}' \; -print
Search and Replace within a File
This will find a "b" and replace it with "strong" in the file index.htmlsed -i 's/b/strong/g' index.html
Disk Space / Disk Usage
Shows the disk space available and disk space used on each device.du -d 1 | sort -n -r
Directory Space Used
Shows the disk space used by each directory (in current directory). Linux:du -h --max-depth=1 | sort -n -rFreeBSD:
du -d 1 | sort -n -r
Categories:
Linux, Web Development
Copyright © 2004 - 2010 Micah Carrick. All Rights Reserved.
2 Comments about "Some Handy Linux Commands"
RSS Feed
Leave a Comment about "Some Handy Linux Commands"