Files

View file contents

# View from start of file
cat file.txt

# View from end of file
tail -n 100 file.txt

Copy files

# Copy (recursive)
cp -r SOURCE DESTINATION

# Copy from local to server securely
# Example: scp hello.txt brendan@20.30.40.50:httpdocs
scp file.txt user@server:destination

# Copy from server to local securely
# Example: scp brendan@20.30.40.50:httpdocs/hello.txt .
scp user@server:path/to/file.txt .

# Move file to new directory
mv file.txt /path/to/new/destination/

Remove files

# Remove everything in current directory
rm *

# Remove everything in current directory + subfolders
rm -rf *