This quick tutorial provides steps to use the netstat, nmap and lsof command to check the ports in use and view the application that is utilizing the port.
Source: How to check if port is in use on Linux or Unix – nixCraft
This quick tutorial provides steps to use the netstat, nmap and lsof command to check the ports in use and view the application that is utilizing the port.
Source: How to check if port is in use on Linux or Unix – nixCraft
So how do you convert such input? The answer is to use jq or dasel command-line utilities.
Source: How to convert JSON to CSV using Linux / Unix shell – nixCraft
What’s more interesting is that this flaw can be exploited by an attacker to run commands as root just by specifying the user ID “-1” or “4294967295.”
That’s because the function which converts user id into its username incorrectly treats -1, or its unsigned equivalent 4294967295, as 0, which is always the user ID of root user..
Source: Sudo Flaw Lets Linux Users Run Commands As Root Even When They’re Restricted
In this tutorial, we will see how to use the terminal to clean up unused memory that was not released properly after being used by your system. No need to use any third-party software, just a few commands will do the job pretty easily.
Source: How to Free up Unused Memory in Ubuntu/Linux Mint
Have a little problem with a server freezing which might be memory related. This simple tutorial was very helpful.
You can free up unused memory under Ubuntu/Linux Mint using this command:
sudo sysctl -w vm.drop_caches=3
The best way to create a ram disk on linux is tmpfs. It’s a filesystem living in ram, so there is no need for ext2. You can create a tmpfs of 16Gb size with:
mount -o size=16G -t tmpfs none /mnt/tmpfs
Source: ramdisk – Creating a ram disk on Linux – Unix & Linux Stack Exchange
What’s the best way to check if a volume is mounted in a Bash script? What I’d really like is a method that I can use like this: if <something is mounted at /mnt/foo> then <Do some
Source: What’s the best way to check if a volume is mounted in a Bash script?
Avoid using
/etc/mtab
because it may be inconsistent.Avoid piping
mount
because it needn’t be that complicated.Simply:
if grep -qs '/mnt/foo' /proc/mounts; then echo "It's mounted." else echo "It's not mounted." fi
The securelevel mechanism is intended to allow protecting the persistence of code and data on the system, or a subset thereof, from modification, even by the super-user by providing convenient means of “locking down” a system to a degree suited to its environment.
Source: NetBSD 6.1.5 – man page for secmodel_securelevel (netbsd section 9) – Unix & Linux Commands
Highly secure mode may seem Draconian, but is intended as a last line of defence should the super-user account be compromised. Its effects preclude circumvention of file flags by direct modification of a raw disk device, or erasure of a file system by means of newfs(8). Further, it can limit the potential damage of a compromised “firewall” by prohibiting the modification of packet filter rules. Preventing the system clock from being set backwards aids in post-mortem analysis and helps ensure the integrity of logs. Precision timekeeping is not affected because the clock may still be slowed.
lshw (Hardware Lister) command gives a comprehensive report about all hardware in your system. This displays detailed information about manufacturer, serial number of the system, motherboard, CPU, RAM, PCI cards, disks, network card etc.,
Source: How To Get Hardware Specs of Your System Using lshw Hardware Lister
Glantz explained that the first step in the assembly of his IT infrastructure is to have a well-defined Standard Operating Environment (SOE). The SOE includes a definition of the hardware platforms used as well as the Linux and application software that is installed. There is also an installation and configuration management layer that helps enforce the SOE across the distributed Ikea IT footprint. Additionally, Glantz has defined a lifecycle-management plan that describes the lifecycle of how Linux will be used at Ikea for the next seven years.”
It’s not enough just to have documents, you have to have systems driving how technology works,” Glantz said.
Source: Ikea Patched for Shellshock by Methodically Upgrading All Servers
Just a list of 20 (now 28) tools for the command line. Some are little-known, some are just too useful to miss, some are pure obscure — I hope you find something useful that you weren’t aware of yet! Use your operating system’s package manager to install most of them. (Thanks for the tips, everybody!)
via Cool, but obscure unix tools :: Software architect Kristof Kovacs.