Labels

Aliases are custom commands

Aliases are custom commands which can be used to make the work with the shell easier and faster. For example, if your current working directory is /usr/bin and you want to quickly go to /var/cache/apt/archives you can do a 'cd /var/cache/apt/archives'. If you want to save time, you may want to type only a command such as 'cache' or 'debs. Or you may want to update your Debian system in one command, so instead of typing 'su -c "apt-get update && apt-get upgrade"' you only type 'upgrade' or something of your choice. This is where aliases come to help.

In this How-To I will explain two ways of creating aliases.

Method 1
The first method is to add aliases directly into your ~/.bashrc file. The format should be:
alias name='command'
For example you can add something like:
alias ll='ls -l'
alias deb='cd /var/cache/apt/archives'
alias dld='cd ~/downloads'
alias upgrade='su -c "apt-get update && apt-get upgrade"'
Open a console and try your aliases. For example if you type 'deb', the current working directory will be changed to /var/cache/apt/archives.

Method 2
The second method lets you make a separate aliases file, so you won't have to put them in ~/.bashrc, but to a file of your choice. First, edit your ~/.bashrc file and add or uncomment the following lines:
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
Save it and close the file. After that, all you have to do is create a ~/.bash_aliases file and add your aliases there, with the same format specified at the first method.
READ MORE - Aliases are custom commands

How-To: Manipulate Audio Files Using CLI Tools in Debian

Note: This how-to may also work in Ubuntu and other Debian-based distributions.

This is a tutorial about using CLI (Command Line Interface) tools in Ubuntu and Debian to manipulate, encode and decode various audio formats, like FLAC or OGG Vorbis. It describes the packages needed to install, and some basic commands for converting audio files and working with CUE and FLAC files.The commands in this tutorial were tested in Kubuntu 7.10 Gutsy Gibbon and Debian Lenny, with all the updates to date.

Command line tools such as oggenc or flac can be used for example to convert FLAC (Free Lossless Audio Codec) files or WAV (WaveForm Audio Format) in OGG Vorbis files. Vorbis is a free audio codec offering lossy compression, and is known to have a smaller size and better quality (at least for lower bitrates) than the widely used MP3.

All the tools used in this tutorial are available through four packages, and to install them issue the following command as root (Ubuntu users must precede it with sudo, since the root account is disabled by default in Ubuntu):

apt-get install flac vorbis-tools cuetools shntool

These packages contain several programs and utilities for manipulating audio files. To convert a FLAC file into WAV do a:

flac -d file.flac

If there are several FLAC files in the same directory, use the command:

flac -d *.flac

And all the files with the .flac extension will be converted. Of course, one can include many more options, like the name of the output file. Do a man flac or a flac --help command to see detailed help and a list of options. To convert either WAV or FLAC files into OGG, execute one of the following commands:
oggenc -b 192 *.wav
oggenc -b 192 *.flac
The -b option refers to the bitrate of the resulting OGG file, in this case the average bitrate being 192 kbps. Or you can choose to use the quality option:

oggenc -q 6 *.flac

The quality is represented on a scale from 1 to 10, 10 being the highest. More details on the official website. Some albums may come as a single FLAC file and a CUE file which stores the information needed to split the former. In this case the programs cuebreakpoints and shnsplit come in handy:

cuebreakpoints album_name.cue | shnsplit album_name.flac

And the same goes with the WAV:

cuebreakpoints album_name.cue | shnsplit album_name.wav

It will result in several .flac or .wav files, split according to the lengths specified in the CUE file. You can also edit the CUE file with a text editor and change the split lengths, for concatenating two melodies or more in a single one.

Once you obtained the desired OGG Vorbis files, you may want to edit or remove their tags. To clear all the tags in an OGG Vorbis file, use the vorbiscomment tool. For example:
touch file
vorbiscomment -w song.ogg -c file
The first command will create an empty file (if it doesn't already exist). The second one will edit the tags in song.ogg with the info found in file, which is none. Here is a script to remove all the tags from all Vorbis files with OGG extensions in a directory:
#!/bin/bash

echo "OGG Tag Remover"
echo "Creating empty file..."
touch file

echo "Removing all tags in OGG files..."
for i in *.ogg; do
echo "Executing command 'vorbiscomment -w \"$i\" -c file'..."
nice -n 15 vorbiscomment -w "$i" -c file
done

echo "Removing empty file..."
rm file

echo "Done! All tags removed."
Copy this into a file of your choice, say vorbis_rm.bash, make it executable and then run it:
chmod 755 vorbis_rm.bash
./vorbis_rm.bash
All the tags in OGG files will be removed. This is useful when you have large albums and you want to clear some wrong edited tags in one command and start clear.

Some audio players like Amarok offer an easy tag editing system. However, to make your work even faster, you can use various Bash scripts which edit as much as is needed to just leave only fields like TITLE unfilled. Next is an example of a script which automatically fills the TRACKNUMBER field for each OGG file in a directory:
#!/bin/bash

echo "OGG TRACKNUMBER Edit"

n=1
for i in *.ogg; do
echo "Executing command 'vorbiscomment -a \"$i\" -t \"TRACKNUMBER=$n\"'"...
nice -n 15 vorbiscomment -a "$i" -t "TRACKNUMBER=$n"
n=$((n + 1))
done

echo "Done. TRACKNUMBER tags completed."
After running this script in a directory with OGG files, all of them will have the TRACKNUMBER field completed.
READ MORE - How-To: Manipulate Audio Files Using CLI Tools in Debian
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

try to resolved with this command :

~$ sudo apt-get update --fix-missing

and then, try to run ~$ sudo apt-get install app-you-want-to-install

READ MORE -

YUM packages tool (Fedora, RedHat and alike)

# yum -y install [package]
download and install a rpm package [man]

# yum localinstall [package.rpm]
That will install an RPM, and try to resolve all the dependencies for you using your repositories. [man]

# yum -y update
update all rpm packages installed on the system [man]

# yum update [package]
upgrade a rpm package [man]

# yum remove [package]
remove a rpm package [man]

# yum list
list all packages installed on the system [man]

# yum search [package]
find a package on rpm repository [man]

# yum clean [package]
clean up rpm cache erasing downloaded packages [man]

# yum clean headers
remove all files headers that the system uses to resolve dependency [man]

# yum clean all
remove from the cache packages and headers files [man]
READ MORE - YUM packages tool (Fedora, RedHat and alike)