There are several ways to check if a Linux server is overloaded. Here are some common methods:

Check CPU usage: Use the ‘top’ or ‘htop’ command to check the CPU usage of the system. If the CPU usage is consistently high (above 80%), it could indicate an overloaded server.

Check memory usage: Use the ‘free’ or ‘vmstat’ command to check the memory usage of the system. If the system is using all of its available memory, it could indicate an overloaded server.

Check disk usage: Use the ‘df’ command to check the disk usage of the system. If the disk usage is consistently high (above 80%), it could indicate an overloaded server.

Check network usage: Use the ‘iftop’ command to check the network usage of the system. If the network usage is consistently high (above 80%), it could indicate an overloaded server.

Check system logs: Check the system logs for any error messages or warnings that could indicate an overloaded server. Use the ‘tail’ command to view the last few lines of the logs.

Check running processes: Use the ‘ps’ command to check the running processes on the system. If there are a large number of processes running, it could indicate an overloaded server.

Once you have identified the source of the overload, you can take steps to address it, such as optimizing your application or upgrading your server hardware.

https://support.surfshark.com/hc/en-us/articles/360017418334-How-to-set-up-Surfshark-VPN-on-Linux-

Useful Commands

Start VPN

# sudo surfshark-vpn

Use this command to print all Surfshark commands in the terminal:

# surfshark-vpn help

Check your connectivity status:

# surfshark-vpn status

Disconnect from Surfshark VPN:

# sudo surfshark-vpn down

Quick-connect to your Optimal location:

# sudo surfshark-vpn attack

To log out of the client:

# sudo surfshark-vpn forget

To connect to a MultiHop location:

# sudo surfshark-vpn multi

To uninstall Surfshark:

# sudo apt-get remove surfshark-vpn

How do I display a list of all network cards under Linux operating systems?

You can use any one of the following command to list network cards installed under Linux operating systems. Please note that the ifconfig and ip commands will also display interfaces information about vpn, loopback, and other configured interfaces.

  • lspci command : List all PCI devices.
  • lshw command : List all hardware.
  • dmidecode command : List all hardware data from BIOS.
  • ifconfig command : Outdated network config utility.
  • ip command : Recommended new network config utility.
  • lspci command

Type the following command:

# lspci | egrep -i --color 'network|ethernet'

Sample outputs:

09:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5761e Gigabit Ethernet PCIe (rev 10)
0c:00.0 Network controller: Intel Corporation Ultimate N WiFi Link 5300

lshw command

The lshw command can extract detailed information on the hardware configuration of the machine including network cards. Type the following command:

# lshw -class network

Sample outputs:

  *-network DISABLED      
       description: Wireless interface
       product: Ultimate N WiFi Link 5300
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:0c:00.0
       logical name: wlan0
       version: 00
       serial: 00:21:6a:ca:9b:10
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=3.2.0-0.bpo.1-amd64 firmware=8.83.5.1 build 33692 latency=0 link=no multicast=yes wireless=IEEE 802.11abgn
       resources: irq:46 memory:f1ffe000-f1ffffff
  *-network
       description: Ethernet interface
       product: NetXtreme BCM5761e Gigabit Ethernet PCIe
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:09:00.0
       logical name: eth0
       version: 10
       serial: b8:ac:6f:65:31:e5
       size: 1GB/s
       capacity: 1GB/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm vpd msi pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.121 duplex=full firmware=5761e-v3.71 ip=192.168.1.5 latency=0 link=yes multicast=yes port=twisted pair speed=1GB/s
       resources: irq:48 memory:f1be0000-f1beffff memory:f1bf0000-f1bfffff

ifconfig and ip command

To see all configured network devices, enter:

# ifconfig -a

OR

# ip link show

OR

# ip a

Sample outputs:

1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc mq state UP qlen 1000
    link/ether b8:ac:6f:65:31:e5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.5/24 brd 192.168.1.255 scope global eth0
    inet6 fe80::baac:6fff:fe65:31e5/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0:  mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:21:6a:ca:9b:10 brd ff:ff:ff:ff:ff:ff
4: pan0:  mtu 1500 qdisc noop state DOWN 
    link/ether 92:0a:e7:31:e0:83 brd ff:ff:ff:ff:ff:ff
5: vmnet1:  mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:01 brd ff:ff:ff:ff:ff:ff
    inet 192.168.121.1/24 brd 192.168.121.255 scope global vmnet1
    inet6 fe80::250:56ff:fec0:1/64 scope link 
       valid_lft forever preferred_lft forever
6: vmnet8:  mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff
    inet 192.168.179.1/24 brd 192.168.179.255 scope global vmnet8
    inet6 fe80::250:56ff:fec0:8/64 scope link 
       valid_lft forever preferred_lft forever

/proc/net/dev

The dev pseudo-file contains network device status information. This gives the number of received and sent packets, the number of errors and collisions and other basic statistics.

$ cat /proc/net/dev

Sample outputs:

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:   20097     179    0    0    0     0          0         0    20097     179    0    0    0     0       0          0
vmnet8:       0       0    0    0    0     0          0         0        0      33    0    0    0     0       0          0
  pan0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
 wlan0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0: 592509534  623058    0    0    0     0          0      1053 122269656  401567    0    0    0     0       0          0
vmnet1:       0       0    0    0    0     0          0         0    

  1. cheat_sheet.org
  2. (C) William Hackmore, 2010
  3. The contents of this file are released under the GNU General Public License. Feel free to reuse the contents of this work, as long as the resultant works give proper attribution and are made publicly available under the GNU General Public License.
  4. Last updated 8/14/2012
  5. Best viewed in emacs org-mode.
  • Command Reference:
    • Basics:
      • Getting help:
  1. View the manual for target command
man [command]
  1. Get help with a target command (probably the same as above, but not always):
[command] -h
  1. In case you forget the name of a command, print possible commands relating to [guess]:
apropos [guess]
  1. View index of help pages:
info
      • Command Line Utilities:
        • Basic File and Directory Operations:
  1. Print current working directory:
pwd
  1. Show files in current directory:
ls
  1. Show maximum information about all files, including hidden:
ls -a
  1. Recurse into subdirectories and list those as well:
ls -r
  1. Move/rename a file or directory (be careful that you don’t move the source over a destination with the same name):
mv [source] [destination]
  1. Delete target forever (be very careful), use -r recursive flag for directories:
rm [target]
  1. Copy file or directory:
cp [source] [destination]
  1. Mount filesytem:
mount /dev/[device name] /media/[device name]
  1. Unmount:
umount /media/[device name]
  1. Forensically clone filesystems and do other low-level operations on files. Very dangerous:
dd
  1. Work with filesystems and partitions. (Easier, still quite dangerous):
fdisk
        • System Administration:
  1. Execute command as an administrator (dangerous, but necessary for system administration tasks):
sudo [command]
  1. Become system administrator:
sudo -s
  1. Quit system administration:
exit
  1. Check distro repositories for software updates:
sudo apt-get update
  1. Download and install updates (update first):
sudo apt-get upgrade
  1. Search for package in the repositories:
apt-cache search [keyword]
  1. Get more detail on one specific package:
apt-cache show [package name]
  1. Download and install a package:
sudo apt-get install [package name]
  1. View the output of a command in a more convenient format:
[command] | less
        • Working With Files:
  1. Print a file in terminal:
cat [file]
  1. Find files matching [filename]:
locate [filename]
  1. Search through [filename] for matches to [phrase]:
grep [phrase] [filename]
  1. Search through output of a command for [phrase]:
[command] | grep [phrase]
        • Working With Processes:
  1. List all running processes:
ps -e
  1. Standard system monitor showing a more extensive view of all processes and system resources:
top
  1. Like top, but with a better, cleaner interface:
htop
  1. Stop a process from using all system resources and lagging computer:
nice [process name]
  1. Kill misbehaving process (use sparingly, last resort, try ‘nice’ command first):
pkill [process name]
        • Compression and Encryption:
  1. Make a simple compressed backup of a file or directory:
tar -cvzf [backup output.tgz] [target file or directory]
  1. Open a compressed .tgz or .tar.gz file:
tar -xvf [target.tgz]
  1. Encrypt a file:
gpg -o [outputfilename.gpg] -c [target file]
  1. Decrypt a file:
gpg -o [outputfilename] -d [target.gpg]
  1. Zip and encrypt a directory simultaneously:
gpg-zip -o encrypted-filename.tgz.gpg -c -s file-to-be-encrypted
      • The Bash shell:
        • File Name expansions:
  1. Current user’s home directory:

~/

  1. Current directory:
./
  1. Parent directory:
../
  1. Or even (Two parent directories down):
../../
  1. All files in target directory. (Be very careful.):
/*
        • Output Redirects:
  1. Redirect output of one command into the input of another with a pipe:
[command 1] | [command 2]
  1. Or even:
[command 1] | [command 2] | [command 3]
  1. Redirect output to a file:
[command] > file
  1. Or:
[file] > [file]
  1. Or even, to redirect in a different direction:
[file] < [file]
  1. Append output rather than writing over the target file:
[file/command] >> [file]
  1. Works like |, but it writes output to both target and terminal:

tee [target]

        • Controlling Execution:
  1. Wait until [command 1] is finished to execute [command 2]
[command 1] ; [command 2]
  1. Or even:
[command 1] ; [command 2] ; [command 3]
        • Wildcards:
  1. Zero or more characters:
*
  1. Matches “phrase” and any number of trailing characters:
phrase*
  1. Matches any incidences of “phrase” with any trailing or leading chars:
*phrase*
  1. Matches any one char:
?
  1. Matches any of the characters listed inside brackets:
[chars]
  1. Matches a range of chars between a-z:
[a-z]
    • Advanced:
      • Command Line Utilities, Continued:
        • Networking:
  1. Configure network interfaces:
ifconfig
  1. Configure wireless network interfaces:
iwconfig
  1. Connect to a remote server.
ssh [username]@[ipaddress]
  1. Forward x from target to current machine (Get a remote desktop. Very obscure and very useful):
ssh -x [username]@[ipaddress]
  1. Copy files over the network from one machine to another:
scp [source filename]:[username]@[ipaddress] [target filename]:[target username]@[target ipaddress]
  1. Copy only changes between files or directories (super efficient way to sync directories, works either locally or with remote servers using username@ipaddress:optionalport, just like ssh):
rsync [source] [target]
  1. Check to see if target is online and responding
ping [ip address]
  1. View network route to target:
traceroute6 [ip address]
  1. Network Monitor
netstat
  1. Manage standard linux firewall (advanced users only)
iptables
  1. Scan this machine to check for open ports:
nmap 127.0.0.1
          • netcat:
  1. Listen for input from network on [recieving port], dump it to a file (possibly insecure):
netcat -l [recieving port] > file_copied
  1. Pipe the output of a command to a target ip and port over the network:
[command] | netcat -w [number of seconds before timeout] [target ip] [target port]
  1. Use tar to compress and output a file as a stream, pipe it to a target ip and port over the network:
sudo tar -czf - [filename] | netcat -w [number of seconds before timeout] [target ip] [target port]
        • Users and Groups:
  1. Change owner of a file or directory:
chown
  1. Change privileges over file or directory:
chmod
  1. Create a new user:
adduser
  1. Change user privileges (be very careful with this one):
usermod
  1. Delete user”
deluser
  1. Print groups:
groups
  1. Create a new group:
groupadd
  1. Change group privileges:
groupmod
  1. Delete group:
delgroup
  1. Temporarily become a different user:
su [username]
  1. Print usernames of logged in users:
users
  1. Write one line to another user from your terminal:
talk
  1. Interactive talk program to talk to other users from terminal:
ytalk
        • Working With Files, Continued:
  1. View what processes are using what files:
lsof
  1. View the differences between two files:
diff [file 1] [file 2]
  1. Output the top -n lines of [file]:
head -n [number of lines] [file]
  1. Like head, but it outputs the last -n lines:
tail
  1. Checksum a file:
md5sum [file]
  1. Checksum every file in a directory:
md5deep [directory]
  1. Checksum a file (safer algorithm with no hash collisions):
sha1sum
  1. Same operation as md5deep, but using sha1:
sha1deep
  1. Call [command] every -n seconds, and display output:
watch -n [number of seconds] [command]
  1. Execute [command], print how long it took:
time [command]
  1. View files in home from largest to smallest:
du -a ~/ | sort -n -r | less
  1. remove spaces from filenames in current directory
rename -n 's/[\s]/<i>/g' *</i>
  1. change capitals to lowercase in filenames in current directory
rename 'y/A-Z/a-z/' *
          • Environment and Hardware:
  1. Print full date and time:
date
  1. Print the hostname of this machine:
echo $HOSTNAME
  1. Print information about current linux distro:
lsb_release -a
  1. Print linux kernel version:
uname -a
  1. Print information about kernel modules:
lsmod
  1. Configure kernel modules (never do this):
modprobe
  1. View Installed packages:
dpkg --get-selections
  1. Print environment variables:
printenv 
  1. List hardware connected via PCI ports:
lspci
  1. List hardware connected via USB ports:
lsusb
  1. Print hardware info stored in BIOS:
sudo dmidecode
  1. Dump captured data off of wireless card:
dumpcap
  1. Dump info about keyboard drivers:
dumpkeys
          • System Administration (Continued):
  1. Add a Personal Package Archive from Ubuntu Launchpad:
add-apt-repository
  1. Install a .deb file from command line:
sudo dpkg -i package.deb
        • Python:
  1. update pip (Python package manager):
pip install -U pip
  1. search pip repos
pip
  1. create a virtual python environment
virtualenv [dirname] --no-site-packages
  1. connect to a virtual python environment
source [dirname]/bin/activate
  1. disconnect from a python environment:
deactivate
  1. install package into virtual python environment from outsie:
pip install [packagename]==[version_number] -E [dirname]
  1. export python virtual environment into a shareable format:
pip freeze -E [dirname] &gt; requirements.txt
  1. import python virtual environment from a requirements.txt file:
pip install -E [dirname] -r requirements.txt
        • git (all commands must be performed in the same directory as .git folder):
  1. Start a new git project:
git init
  1. Clone a git (target can be specified either locally or remotely, via any number of protocols):
git clone [target]
  1. Commit changes to a git:
git commit -m "[message]"
  1. Get info on current repository:
git status
  1. Show change log for current repository:
git log
  1. Update git directory from another repository:
git pull [target]
  1. Push branch to other repository:
git push [target]
  1. Create a new branch:
git branch [branchname]
  1. Switch to target branch:
git checkout [branchname]
  1. Delete a branch:
git branch -d [branchname]
  1. Merge two branches:
git merge [branchname] [branchname]
      • Virtualization:
  1. clone a virtual machine (this works, it’s been tested):
vboxmanage clonehd [virtual machine name].vdi --format VDI ~/[target virtual machine name].vdi
  1. mount a shared virtual folder:
  2. you need to make sure you have the right kernel modules. You can do this with modprobe, but this package works instead in a ubuntu-specific way.
sudo apt-get install virtualbox-ose-guest-utils
sudo mount -t vboxsf [name of Shared folder specified in Virtualbox] [path of mountpoint]
      • mysql:
  1. Get help:
help
  1. Show databases:
show databases;
  1. Choose a database to use:
use [database name here];
  1. Show database schema:
show tables;
  1. Delete database:
DROP DATABASE [databasename];
  1. New database:
CREATE DATABASE [databasename];
  1. Create a new user:
CREATE USER [username@localhost] IDENTIFIED BY '[password]' ;
  1. Show users:
select * from mysql.user;
  1. Delete a user:
delete from mysql.user WHERE User='[user_name]';
  1. Give user access to all tables (make them root). the “%” means that they can sign in remotely, from any machine, not just localhost.:
grant all privileges on *.* to someusr@"%" identified by '[password]';
  1. give certain privileges to a user on a certain database:
grant select,insert,update,delete,create,drop on [somedb].* to [someusr]@["%"] identified by '[password]';
  1. Tell mysql to use new user priv policies:
flush privileges;
  1. change user password:
use mysql;

update user set password='[password]'(‘[newpassword]’) where User='[user_name]’ ;

  1. mysql command line args:
  1. export text file with commands to rebuild all mysql tables:
mysqldump [databasename] &gt; [dumpfilename.txt]
  1. restore from a dump:
mysql -u [username] -p &lt; [dumpfilename.txt]
  1. dump entire database:
mysqldump -u [username] -p --opt [databasename] &gt; [dumpfile.sql]
  1. restore from entire database dump:
mysql -u [username] -p --database=[databasename] &lt; [dumpfile.sql]

In a typical UNIX/LINUX-style file listing, a file will be displayed in the following way:

ls -l index.php

Output:

-rw-r--r--. 1 www-data www-data 405 Nov 14 01:45 index.php

The first character indicates the file type. It can be a regular file (-), directory (d), a symbolic link (l), or other special types of files. The following nine characters represent the file permissions, three triplets of three characters each. The first triplet shows the owner permissions, the second one group permissions, and the last triplet shows everybody else permissions.

-rw-r--r--.

r stands for read permission;
w stands for write permission;
x stands for execute permission.

The permissions are divided into three parts.

The first three characters after the initial – are (rw-) are for Owner permissions. The owner of the file, the user “www-data”, can read the file and write (modify) it.

The next three characters (r–) are for group permissions. Members of the group “www-data” can read the file.

The last three characters (r–) are for other (world) permissions. These are the permissions for everyone else on the system. Users other than “group” who are not members of the “www-data” group can only read the file.

For directories, the permissions have a slightly different meaning.

For example:

ls -la
drwxr-xr-x  8 www-data www-data  4096 Feb 21 11:28 wp-content

Read determines if the user can get a list of the files in the directory;

Write determines if the user can create or delete files in the directory. A point of interest in this case is that if a user has write access to the directory, the user can delete files that are in that directory even if the username has no write permissions for the particular files;

Execute determines if the user can cd into the directory.

To summarize:

In this case, the owner, user, can do just about anything in the directory. Members of the group staff can list the contents of the directory and browse it. No one else is allowed access to the directory. Permissions are also often represented by digits. For example, 755 is the same as

-rwxr-xr-x.

The permission bits correspond to a certain number: 4 stands for r, 2 for w, 1 for x.

The reason for this is that in binary 100 (r–) is 4 in decimal; 10 (or 010, -w-) in binary is 2; and 1 (or 001, –x) in binary is 1 in decimal.

This allows for adding the numbers together, which can give a number from 0 to 7 for each of the three parts of the permissions set.

Here is a nice grid.

-rw-r--r-- 8 www-data www-data 12.0K Apr  28 10:10 file_name
|[-][-][-]-   [------] [---]
| |  |  | |      |       |
| |  |  | |      |       +-----------> 7. Group
| |  |  | |      +-------------------> 6. Owner
| |  |  | +--------------------------> 5. Alternate Access Method
| |  |  +----------------------------> 4. Others Permissions
| |  +-------------------------------> 3. Group Permissions
| +----------------------------------> 2. Owner Permissions
+------------------------------------> 1. File Type