Linux Commands
-
Files & Navigation
-
Is - directory listing
-
la-l - formatted listing
-
cd dir - change directory
-
cd../dir - change to parent dir
-
cd - returns to home dir
-
pwd - current dir
-
mkdir dir - creates a dir
-
rm file - deletes file
-
rm -f dir - removes dir
-
rm -r delete dir
-
cp file 1 file2 - copy 1 to 2
-
mv filel file2 - move 1 to dir as 2
-
touch file - updates Or Create file
-
cat file - displays content of file
-
cat > file - writes input to file
-
cat >> file - append input to file
-
tail -f file - outputs content as it grows
-
System Info
-
uptime - shows current uptime
-
date - shows date and time
-
who am I - shows loggin status
-
w - who is online
-
cat /proc/cpuinfo - CPU info
-
cat /proc/meminfo - memory info
-
free - memory and swap usage
-
du - directory space usage
-
du-sh - readable size in GB
-
df - disk usage
-
uname-a - kernel co fig
-
Permissions
-
chmod octal file - change permissions of file
-
4 -read (r)
-
2 - write (w)
-
1 - execute (x)
-
order - owner/group/world
-
chmod 777 - rwx everyone
-
chmod 755 - rw for owner, rx for world
-
Processes
-
ps - current active process
-
ps aux - detailed outputs
-
kill pids - kills process with id
-
kill all proc - kills all process
-
named proc
-
Networking
-
whois domain - get whois for domain
-
ping host - pings host
-
dig domain - gets DNS for domain
-
dig -x host - reserve lookup host
-
wget file - download file
-
wget -c file - continue stopped download
-
ssh user@host - connects as host
-
ssh -p port user@host - connects using port
-
ssh -D user@host - connects & binds port
-
Compressing
-
tar cf file.tar files - change file to file.tar
-
tar xf file.tar - untar in current dir
-
tar tf file.tar - shows archive contents