These are personal notes to remind myself how to do certain types of installations via the command line in the terminal. Some notes are for actions I do often, others that I've only done once, but that the process I thought was worth noting.
- How to fix broken pipe in an SSH session
- Export images to pdf with GIMP
- Make appimage executable
- How to format USB on Linux
- Install terminal dictionary
I use fish, a command line shell, commands may vary because of this.
A list of some useful commands:
- cd, change the current directory
- ls, list files and directories
- man, display a manual page on the screen
- mv, move (rename) files
- cp, copy files
- open, open files with the default application associated with each filetype
- less, list the contents of files
How to fix broken pipe in an SSH session
Sometimes session disconnects with a write failed: broken pipe message. My server closed the connections because they were idling for too long. To fix it, update your your client (ServerAliveInterval) or your server (ClientAliveInterval).
ServerAliveInterval. Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server. This option applies to protocol version 2 only.
ClientAliveInterval. Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. This option applies to protocol version 2 only.
To update your server (and restart your sshd)
echo "ClientAliveInterval 60" | sudo tee -a /etc/ssh/sshd_config
echo "ServerAliveInterval 60" >> ~/.ssh/config
Back to top.
Export images to pdf with GIMP
Combine images in same file on layers. Export as a .mng file using the default export settings. Convert to PDF using imagemagick. If you don't have it, install it first.
sudo apt-get install imagemagick
Convert your files, that's it.
convert -reverse document.mng document.pdf
Back to top.
Make appimage executable
Back to top.
How to format USB on Linux
Insert the USB flash drive or SD card into your Linux machine and find the device name using the lsblk -fp command:
$ lsblk -fp NAME FSTYPE LABEL UUID MOUNTPOINT /dev/sda └─/dev/sda1 LVM2_member c52... ├─/dev/mapper/mint--vg-root ext4 183... / └─/dev/mapper/mint--vg-swap_1 swap 337... [SWAP] /dev/sdb └─/dev/sdb1 vfat USB Drive 345... /media/user/usb0
In the example above, the USB drive is recognized by the operating system as a disk named /dev/sdb with a single partition /dev/sdb1 mounted on /media/user/usb0. Unmount the USB drive if it is mounted:
sudo umount /media/user/usb0
- NTFS: The NT File System (NTFS) is the file system that modern Windows versions use by default.
- HFS+: The Hierarchical File System (HFS+) is the file system modern macOS versions use by default.
- APFS: The proprietary Apple file system developed as a replacement for HFS+, with a focus on flash drives, SSDs, and encryption. APFS was released with iOS 10.3 and macOS 10.13, and will become the mandatory file system for those operating systems.
- FAT32: The File Allocation Table 32 (FAT32) was the standard Windows file system before NTFS.
- exFAT: The extended File Allocation Table (exFAT) builds on FAT32 and offers a lightweight system without all the overhead of NTFS.
- EXT 2, 3, & 4: The extended file system (EXT) was the first file system created specifically for the Linux kernel.
To convert to FAT32, enter desired label name (optional):
$ sudo mkfs.fat -F 32 /dev/sdb1 -n "USB Drive"
Back to top.
Install a terminal dictionary
Half of the online searches I make are for word definitions, or synonyms. A good physical dictionary is useful, but there are times when searching online is quicker. I didn't want to use anything with an interface, as they tend to be messy, and in this case, my needs are very simple. A terminal dictionary as for me, the better option. Enter SDCV.
SDCV, or StarDict Console Version, is the terminal utility version of StarDict extensible GUI dictionary application. Here's how to install it:
sudo apt-get install sdcv
SDCV is now installed, but has no dictionaries to search from yet. SDCV requires files in a DICT format. You can pick the ones you want from the list here, recommended by StarDict. To start, you can download the Collaborative International Dictionary of English.
Next, navigate to the folder where you will place your dictionary.
Make a directory named 'stardict', and another in it named 'dic'. To make a directory, use sudo mkdir followed by the name of your new directory.
Next, we'll uncompress and move the dictionary in one go, using the following command. Modify INSERTNAME with the name of the file you've downloaded.
sudo tar -xjvf INSERTNAME -C /usr/share/stardict/dic
Enter your password, and voila! To use SDCV, type sdcv followed by the word you're looking for, for example:
Back to top.