0% found this document useful (0 votes)
6 views

Soc Linux Cheatsheet

This document is a Linux cheat sheet for the School of Computing, detailing various file and directory commands, file permissions, help commands, system commands, shortcuts, and remote access commands. It provides concise command syntax and descriptions for each action, making it a useful reference for users working in a Linux environment. The cheat sheet includes examples for clarity and emphasizes important commands for file management and system navigation.

Uploaded by

EiRsVi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Soc Linux Cheatsheet

This document is a Linux cheat sheet for the School of Computing, detailing various file and directory commands, file permissions, help commands, system commands, shortcuts, and remote access commands. It provides concise command syntax and descriptions for each action, making it a useful reference for users working in a Linux environment. The cheat sheet includes examples for clarity and emphasizes important commands for file management and system navigation.

Uploaded by

EiRsVi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

School of Computing – Linux Cheat Sheet

File and directory commands


Command Action
ls displays files/directories in 3 column format
ls -la displays files/directories in long format, including hidden files
ls -R displays files/directories recursively
ls -F displays files/directories and appends indicator for file type or directory
ls --color=auto control whether color is used to distinguish file types. (never, always or auto)
cd dir change directory to dir
pwd show current directory
mkdir dir create a directory dir
rmdir dir delete directory dir
rm file delete file
rm -r dir delete directory dir
rm -f file force remove file
rm -rf dir force remove dir (DANGEROUS)
cp file1 file2 copy file1 to file2
cp file1 file2 copy dir1 to dir2; create dir2 if it doesn't exist
mv file1 file2 rename or move file1 to file2
if file2 is an existing directory, moves file1 into
directory file2
touch file create or update file
cat file displays contents of file
less file displays contents of file, allows for forward/reverse navigation of file
head file output the first 10 lines of file
tail file output the last 10 lines of file
tail -f file output the last 10 lines of file and output continues as file is being updated, to
end CTRL+C
grep word or "phrase" file search file for word or "phrase"
NOTE: case sensitive. Phrase must be enclosed in quotes
grep word or "phrase"* search all files in current directory for word or "phrase"
NOTE: case sensitive. Phrase must be enclosed in quotes
grep -i word or "phrase" file search file for word or "phrase"
Case insensitive. Phrase must be enclosed in quotes
grep -i word or "phrase"* search all files in current directory for word or "phrase"
NOTE: case insensitive. Phrase must be enclosed in quotes
find . –name file Starting at current directory look for the file named file
find dir –name file Starting at dir look for the file named file

File Permissions
chmod octal file – change the permissions of file to octal, which can be found separately for user, group, and
world by adding:
• 4 – read (r)
• 2 – write (w)
• 1 – execute (x)
Examples:
chmod 777 – read, write, execute for all
chmod 755 – rwx for owner, rx for group and world
Help commands
Command Action
progname --help or progname -h displays help/usage for program – if provided
man progname displays documentation for progname
man -k progname searches all documentation containing progname

System commands
Command Action
date shows the current date and time
cal show this month's calendar
whoami who you are logged in as
df show quota information/disk usage
which progname shows path information for progname

Short cuts
Command Action
Ctrl+C halts current command
Ctrl+D logout, similar to exit
Ctrl+U erases line of input at command line
!! repeats last command
history displays history of commands with number of command
!# repeats # of command from history,
Example: !76 will repeat the 76th command in history
up arrow displays last command, continually pressing up arrow will allow to scroll
through previous commands
tab auto complete

Remote Access
Command Action
ssh $USER@$HOST open a secure shell connection as $USER at $HOST
ssh -Y $USER@$HOST open a secure shell connection as $USER at $HOST allowing to run X11
tunneling
scp $USER@$HOST: file dir/ secure copy a file to $HOST as $USER

ssh Accessing a $HOST on campus


username@dragon2.cs.clemson.edu
1. ssh Accessing a $HOST from off campus. 1st ssh into access.cs.clemson.edu, with
username@access.cs.clemson username. Once logged into access.cs.clemson.edu, you can then ssh into any
.edu lab machines (username not necessary)
2. ssh dragon2.cs.clemson.edu

You might also like