howtos


High speed HTTP/ HTTPS/ FTP/ BitTorrent/ MetaLink downloads from terminal

aria2c -V --max-concurrent-downloads=7 --ftp-user=useaccount --ftp-passwd=usersecret ftp://useraccount:[email protected]/somefolder/somefile

aria2c is a versatile command line utility that allows the user to download efficiently files using multiple protocols (HTTP/HTTPS/FTP/BitTorrent/MetaLink).


Add an existing user to an existing group

Add an existing user to secondary/supplementary user group using the -a option

usermod -a -G groupname useraccount;

The usermod command is a Linux utility used to modify the user account information stored in the /etc/passwd and /etc/group files. The -a option is used to append the specified user account to the specified group. The -G option is used to specify the group name that the user account will be added to. The groupname argument is the name of the group that the user account will be added to, and the useraccount argument is the name of the user account that will be added to the group.

In this command, the user account specified by “useraccount” will be added to the group specified by “groupname”. The -a option ensures that the user account will be added to the specified group without removing it from any other groups it may belong to. The -G option specifies that the user account will be added to the specified group as a secondary group.

Once the user account has been added to the specified group, it will have the permissions and access rights associated with that group. For example, if the group has permissions to read and write to certain files or directories, then the user account will also have these permissions once it has been added to the group.

It’s important to note that changes made with the “usermod” command are not applied immediately. The changes will take effect after the next time the user logs in or after a system reboot. Additionally, it’s important to use this command with caution as adding a user to the wrong group could grant unintended access rights to sensitive information.

In conclusion, the usermod -a -G groupname useraccount command is a useful tool for managing user accounts and group memberships in Linux systems. By adding a user account to a specific group, administrators can grant the user access to specific resources and permissions, making it easier to manage and control access to resources on a system.


Get the first column of a file in bash

awk '{print $1}' someFile;

The command awk '{print $1}' someFile is a command that is used to extract specific data from a file in Unix/Linux systems. It uses the awk scripting language, which is a powerful tool for text processing and data manipulation.

The syntax of the command is as follows: awk ‘{print $1}’ someFile. Here, the awk command is followed by a set of instructions in single quotes. The instructions specify what to do with the data in the file someFile. In this case, the instruction is print $1 which means that awk will print the first field or column of each line in the file.

The $1 in the instruction refers to the first field of each line in the file. Fields in an awk file are separated by whitespace or any other specified delimiter. In this case, the default delimiter is whitespace, so each field is separated by a space or tab.

The someFile in the command is the name of the file that the awk command will process. The file can be any text file and can contain any type of data. The awk command will extract the first field of each line in the file and print it on the screen.

In conclusion, the command “awk ‘{print $1}’ someFile” is a powerful tool for extracting specific data from a file in Unix/Linux systems. The awk scripting language provides a flexible and efficient way to process text data and manipulate it to meet specific requirements.

*NOTE: If you want the second column change $1 to $2 etc. $1 can be replaced by a variable and used in a more elaborate way that applies to more cases/problems.