diff --git a/README.md b/README.md index 7f347fe..31ddc19 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ Linux-Commands-Cheat-Sheet ========================== +[![Join the chat at https://gitter.im/petronbot/Linux-Commands-Cheat-Sheet](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/petronbot/Linux-Commands-Cheat-Sheet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + A compilation of some commonly used Linux commands for beginners (and those of us who often just forget :)) Files & Folders @@ -33,6 +35,15 @@ Some common commands for navigating, moving, deleting & more! ##### Unzip a file or folder tar -xvzf filename.tar.gz +##### Find and replace in a file + sed -i '' 's/old/new/g' file.ext + +- `sed` = Stream EDitor +- `-i` = in-place (i.e. save back to original file) +- `old` = regex to replace +- `new` = text to replace it with +- `g` = global (i.e. replace all, not just first) + Transferring files ---------------- @@ -45,6 +56,12 @@ Securely (over SSH) and locally ##### Copy a folder from one location to another cp -r /path/to/folder /path/to/dest +##### Sync two folders + rsync -a /path/to/folder /path/to/dest + +- `-a` = Archive, syncs recursively and preserves sym links, special and device files, modification times, group, owner, and permissions +- Source folder can be a remote, e.g. `username@server.com:/path/to/folder` +