Linux Flashcards
How to check the kernel version of a Linux system?
Uname -a
How to see the current IP address on Linux?
Ip a
How to check for free disk space in Linux?
df -ah
How to see if a Linux service is running?
Service –status-all
Service
How to check the size of a directory in Linux?
Du -sh foldername
How to check for open ports in Linux?
Netstat -tulpn
ON REMOTE HOST
telnet 8.8.8.8 53
nc -w5 -z -v (AKA NETCAT)
How to check Linux process information (CPU usage, memory, user information, etc.)?
Ps aux
Top
htop
How to deal with mounts in Linux
mount
what does LSOF return
the list of open files COMMAND PID TID TASKCMD USER FD (file descriptor) TYPE DEVICE SIZE NODE NAME
Difference b/t CTRL-C and CTRL-Z in linux
CTRL - C sends SIGINT which interrupts the application, usually cause process abort and give you a blank prompt
CTRL - Z send SIGSTP which sends the application to suspend mode on the backend to be continued later with fg
Difference between Tar and ZIP
tar is only an archiver while zip archives and compresses.
tar preserves setuid, setgid, and sticky bit
SETUID
Setuid is a Linux file permission setting that allows a USER to execute that file or program with the permission of the owner of that file. This is primarily used to elevate the privileges of the current user.
SETGUID
Setuid is a Linux file permission setting that allows a USER to execute that file or program with the permission of the owner of that file. This is primarily used to elevate the privileges of the current user.
Same as SETUID except with GROUPS
STICKY BIT
Prevents everyone except the OWNER of a directory from deleting a file…like on tmp folders.
How to check open ports on a remote server without NET CAT or NMAP
echo > /dev/tcp// && echo “GOOD” || “BAD”
5 ways to secure an SSH connection.
Disable Password Based Logins and Allow Key based logins
Disable root login
Change the standard port number
Force the service to use only SSH v2
White List users or servers “Allowed List” is the new PC term.
LVM
Logical Volume Manager
LV-extend / LV-reduce to extend or reduce partition sizes
create/resize/delete LVM partitions while the server is running.
How would you connect to a machine in the cloud
Is there a VPN…connect to it.
SSH @
CD
change directory
CD /
LS
list directory contents.
ls [flags] [directory]
PWD
print working directory (path of current directory or the one you choose)
echo
Displays a line of txt
grep
print lines to match patterns
If no FILE is given, recursive searches examine the working directory, and nonrecursive searches read standard
input.
cp
Copy file
cp