This article lists various practical Linux commands to be used only as a reference guide and by experienced Linux users. Not all Linux commands will be available on your system by default so consider install a relevant package before use. This Practical Guide to Linux Commands may list Linux commands you already know but cannot remember usage syntax as well as it may introduce some new Linux commands to improve your Linux command line efficiency. Note, this guide will not teach you how to use Linux commands since it relies on your experience to alter Linux commands syntax below to fit your needs. Read more...
This example shows how to add a character to the beginning of each line using a sed command and bash shell.
Let's create example file.txt with some text:
add character at the beginning of each line
Add character at the beginning of each line using sed command. For example to add # in front of each line we can use sed command with following syntax:
$ sed 's/^/#/' file.txt #add #character #at the #beginning of #each line
replace # with ' ' ( space ) to add space in front of each line:
$ sed 's/^/ /' file.txt add character at the beginning of each line
Redirect the output produced by sed command to save it to a file:
$ sed 's/^/ /' file.txt > new-file.txt
$ cat new-file.txt add character at the beginning of each line
Here is a way how to include Debian/Ubuntu ISO image into your /etc/apt/sources.list file. This kind of hack can prove handy in terms of reducing package download during the installation or if you do not have CD/DVD drive available ( or is broken ) on your system.
Let's assume that we have a Debian ISO image downloaded at the location: /mnt/storage/iSO/debian-i386-DVD-1.iso. As a first step we need to create a mount point to where this ISO image will be mounted to: