Skip to content

Instantly share code, notes, and snippets.

source is a bash shell built-in command that executes the content of the file passed as argument, in the current shell. It has a synonym in . (period).
Be careful! ./ and source are not quite the same.
./script runs the script as an executable file, launching a new shell to run it
source script reads and executes commands from filename in the current shell environment
Note: ./script is not . script, but . script == source script
What is sh
sh (or the Shell Command Language) is a programming language described by the POSIX standard. It has many implementations (ksh88, dash, ...). bash can also be considered an implementation of sh (see below).
Nginx, like Node.js and lighttpd (but unlike Apache, Python or Ruby), is event based. Whenever you are doing network programming you realize that the vast majority of the time is spent waiting on I/O, not actually executing code. Apache solves this by forking and having a bunch of processes, each waiting on one request at a time. Nginx solves this by letting it's processes handle other requests while they are waiting on I/O.
Nginx builds a state machine for each request. Then it uses facilities built in to the operating system to get notified when new data is available on any of its sockets. When new data appears, it moves that request through the state machine, and then it's free to handle other requests. If multiple events come in at once, they get queued.
Nginx doesn't actually use a single worker, it can be configured to use any number, but it's often not necessary to have more workers than there are cores on the machine.
nginx: nginx uses multiplexing and event notifications heavily, and dedicat

The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized method for dynamically accessing process data held in the kernel than traditional tracing methods or direct access to kernel memory. Typically, it is mapped to a mount point named /proc at boot time. The proc file system acts as an interface to internal data structures in the kernel. It can be used to obtain information about the system and to change certain kernel parameters at runtime (sysctl).

Many Unix-like operating systems support the proc filesystem, including Solaris, IRIX, Tru64 UNIX, BSD, Linux, IBM AIX, QNX, and Plan 9 from Bell Labs. The Linux kernel extends it to non–process-related data.

The proc filesystem provides a method of communication between kernel space and user space. For example, the GNU version of the process reporting utility ps uses the proc fil

A disk drive storage is usually persistent, that is, anything that is written to it will always be there exactly as it was written until it’s deleted or modified by an application. Power failures or computer restarts will not (for the most part) effect the data on the storage disk. You are limited in size by the capacity of the disk and the read and write speed will vary depending on the type of drive you have. Generally storage drives tend to be high in capacity and slow in speed.

Does that make sense? Good. tmpfs is nothing like that. tmpfs, as the name suggests, is intended to be for temporary storage that is very quick to read and write from and does not need to persist across operating system reboots. tmpfs is used in Linux for /run, /var/run and /var/lock to provide very fast access for runtime data and lock files. It is also often used for /tmp however it’s not always recommended.

tmpfs uses a combination of computer RAM and disk based SWAP space to create a filesystem, such as EXT4, that the operati

The fingerprint is based on the Host's Public key, usually based on "/etc/ssh/ssh_host_rsa_key.pub" Generally its for easy identification/verification of the host you are connecting to.

If the fingerprint changes, the machine you are connecting to has changed their public key. This may not be a bad thing(happens from re-installing ssh), but it could also indicate that you are connecting to a different machine at the same domain/IP(happens when you are connecting through something like load balancer) or that you are being targeted with a man-in-the-middle attack, where the attacker is somehow intercepting/rerouting your ssh connection to connect to a different host which could be snooping your user/pw.

Bottom line: if you get warned of a changed fingerprint, be cautious and double check that you're actually connecting to the correct host over a secure connection. Though most of the time this is harmless, it can be an indication of a potential issue

TCP is a connection oriented protocol and every connection oriented protocol needs to establish connection in order to reserve resources at both the communicating ends.

Connection Establishment –

Sender starts the process with following: Sequence number (Seq=521): contains the random initial sequence number which generated at sender side. Syn flag (Syn=1): request receiver to synchronize its sequence number with the above provided sequence number. Maximum segment size (MSS=1460 B): sender tells its maximum segment size, so that receiver sends datagram which won’t require any fragmentation. MSS field is present inside Option field in TCP header. Window size (window=14600 B): sender tells about his buffer capacity in which he has to store messages from receiver.

eval [arg ...]
The args are read and concatenated together into a single com-
mand. This command is then read and executed by the shell, and
its exit status is returned as the value of eval. If there are
no args, or only null arguments, eval returns 0.
ls is reporting the allocated size; du is reporting the amount of space actually used.
https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections-on-a-vps
https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/
netcat
The Internet Control Message Protocol (ICMP) is a supporting protocol in the Internet protocol suite. It is used by network devices, including routers, to send error messages and operational information which indicates that a requested service is not available or that a host or router could not be reached.
It is layer 3 i.e. network layer protocol used by the ping command for sending message through ICMP payload which is encapsulated with IP Header packet. According to MTU the size of ICMP packet cannot be greater than 1500 bytes.
ICMP packet at Network layer
IP header ICMP header ICMP payload size MTU (1500)
20 bytes 8 bytes 1472 bytes (maximum) 20 + 8 + 1472 = 1500
Link: https://www.webopedia.com/DidYouKnow/Hardware_Software/router_switch_hub.asp
Some technicians have a tendency to use the terms router, hub and switch interchangeably. One minute they're talking about a switch and discussing router settings the next. Throughout the conversation, however, they're still looking at only one box. Have you ever wondered what the difference is among these devices?
Router vs Switch vs Hub: The Devices Defined
The functions of the three devices — the router, switch and hub — are all quite different from one another, even if at times they are all integrated into a single device. Which device do you use, and when do you use it?
What is a Router?
The router forwards data packets along networks. It is connected to at least two networks, commonly two LANs or WANs or a LAN and its ISP's network. Routers are located at gateways, the places where two or more networks connect. Routers use headers and forwarding tables to determine the best path for forwarding the packets, and they us
Ip Address
An Ip address or Internet Protocol adress is the address assigned to your mobile,printer or computer by the network that uses Internet protocol for communication . Your IP can change with the change in network.IP addresses are divided into classes . A,B,C,D,E mostly we use class B and D
If you want to find your IP address open command prompt
windows->type cmd or
windows->run->cmd
and enter ipconfig on windows or ifconfig in our linux or mac terminal you will find your IP4 and IP6 address .
class