A compilation of some commonly used Linux commands for beginners (and those of us who often just forget :))
Some common commands for navigating, moving, deleting & more!
cd /path/to/folder
mkdir folder
mkdir folder && cd folder
mv /path/to/file.txt /path/to/dest/
mv /path/to/folder1 /path/to/dest/
mv folder1 folder2 /path/to/dest/
ls -l
tar -cvzf filename.tar.gz folder/
tar -xvzf filename.tar.gz
sed -i '' 's/old/new/g' file.ext
sed
= Stream EDitor-i
= in-place (i.e. save back to original file)old
= regex to replacenew
= text to replace it withg
= global (i.e. replace all, not just first)
Securely (over SSH) and locally
cp /path/to/file.txt /path/to/dest
cp -r /path/to/folder /path/to/dest
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
For more info on types of permissions and what they mean, go here
chmod 755 file.txt
chmod -R 755 /path/to/folder