e2fsck

checks ext2/ext3/ext4 filesystems (fs must be unmounted). In case of ext3/4, it first applies journal and then usually exits, unless superblock requires further checking.

e2fsck /dev/sda4

check filesystem on the device /dev/sda4;

e2fsck -f /dev/sda4

force filesystem checking even if journal seems OK;

e2fsck -pv /dev/hda2

check fs on /dev/hda2 and automatically correct errors;

e2fsck -pDf /dev/sda7

force check on /dev/sda7, auto correct errors, optimize dirs;

e2fsck -b 8193 /dev/sda4

check fs on /dev/sda4 and correct errors using an alternative superblock (#8193);

e2fsck [options] device

To check / (root fs), /var and other busy filesystems, you should restart OS using shutdown with -F option, e.g.:

shutdown -r -F now

Some options
-V version;
-v verbose;
-a same as -p (provided for backward compatibility);
-b n use an alternative superblock specified by n; normally used when the primary superblock is corrupted; most fs have backup superblocks located at 8193, 16384, 32768, 98304, 163840, 229376, 294912, etc; location depends on options used for fs creation and block size: it starts from 8193 for fs with 1k block size, from 16384 for fs with 2k block size, from 32768 for fs with 4k block size; if an alternative superblock is specified and the fs is not opened read-only, ~ will make sure that primary superblock is updated appropriately upon completion of the fs check;
-c invoke badblocks; if specified twice, then bad block scan will be done using a non-destructive read-write test (slow);
-D try to optimize all dirs either by reindexing (if fs supports dir indexing) or by sorting and compressing;
-f force checking even if fs seems to be clean;
-F flush the filesystem device's buffer caches before beginning;
-k in combination with -c, add new bad blocks found by badblocks to the list of existing bad blocks;

-l file

add the block numbers listed in file to the list of bad blocks; the format of this file is the same as generated by the badblocks;

-L file

clear existing bad blocks list and set new from file;

-n open fs read-only, and assume "no" to all questions;
-p automatically repair (preen) fs without any questions;
-t print timing statistics; if specified twice, additional statistics are printed on pass by pass basis;
-y assume "yes" to all questions;

The exit code is the sum of the following conditions:

0No errors
1Filesystem errors corrected
2Filesystem errors corrected, system should be rebooted
4Filesystem errors left uncorrected
8Operational error
16Usage or syntax error
32Canceled by user request
128Shared library error

e2label

displays or changes ext2/ext3/ext4 filesystem label.

e2label device [new_label]

If new_label is not specified, the current label is displayed. Otherwise, ~ will set filesystem label to new_label. If new label is longer than 16 characters, it will be truncated.

e2label /dev/sda5

show the label of the filesystem on /dev/sda5;

e2label /dev/sda7 home

set new label home for the filesystem on /dev/sda7;

If ~ outputs some error message, e.g.

Couldn't find valid filesystem superblock.

it does not always mean that filesystem is bad, damaged, etc. Maybe you just need the superuser privilege:

sudo e2label /dev/sdf3

You can also set/change label with tune2fs (see -L option).

env

sets each name to value in the environment and runs cmd. If cmd is missing, ~ outputs the resulting env. The use of - has the same effect as the use of -i option.

env [options] [-][name=value] ... [cmd [arg] ...]

env -u ORACLE_SID ORACLE_SID=prod perl make_rpt4.pl

change ORACLE_SID and run a perl script;

Options

--help    --version

-i, --ignore-environment

start with an empty environment;

-u name, --unset=name

remove variable from the environment;

ethtool

is a utility allowing to query and configure your NIC (Network Interface Card, aka Ethernet card, port, device, link, ...). It also provides info about current state and settings like interface speed, mode, driver, etc.

Installation in Ubuntu Linux:

sudo apt update

sudo apt install ethtool

The manual is big, but basic cmds are simple. However, some of them (e.g. setting/changing configuration) require superuser privileges!

Before you start, find the name(s) of your device(s), e.g.

ip a

Now, assuming that Ethernet NIC's name is, for example, enp7s0, you can get its properties:

ethtool enp7s0

To get info about the currently used driver:

ethtool -i enp7s0

To get network stats (info about network utilization), try following cmd:

ethtool -S enp7s0

(it only works if this feature is supported; see output of the prev cmd).

Changing NIC settings requires some knowledge and experience, otherwise it can go wrong!

The following cmd demonstrates how we can switch OFF auto-negotiation (which is usually ON) and [forcefully] set the desired network speed (must be supported by both sides of the connection). This trick can be useful in situations when the other side of the connection does not support auto-negotiation or network speed is below expectations due to some reasons:

sudo ethtool -s enp7s0 speed 1000 autoneg off

The following feature can be handy if you have several ethernet cards and do not remember which is what:

sudo ethtool -p enp7s0

It makes LED on the specified interface card to blink.

expand

converts TABs to spaces in file, and writes result to stdout.

expand [options] [file] ...

If file is missing, or '-' is given, ~ gets data from stdin.

expand app.cpp > app2.cpp

replace all tabs with spaces in app.cpp and save the modified version to app2.cpp;

Options

--help    --version

-i, --initial

only convert initial TABs, those preceding all non-space or non-TAB characters;

-t n[,m]..., --tabs=n[,m]...

if only n is given, replace each tab with n spaces; otherwise replace first tab with n spaces, second tab with m spaces, etc; when the list is over, replace the remaining tabs with single spaces;

Omitting -t is equivalent to specifying -t 8;