Tag Archives: Linux

Converting WAV files

Converting WAV files

If you have a wav file (in what format?) you can convert it using the sox program. - Raw linear, signed 16 bit, mono, 8000 Hz (.slin)
    sox file.wav -t raw -r 8000 -c 1 -w -s file.slin
- Raw mu-law, mono, 8000 Hz (.mulaw or .u)
    sox file.wav -t raw -r 8000 -c 1 -b 8 -U file.mulaw
- Raw A-law, mono, 8000 Hz (.alaw or .A)
    sox file.wav -t raw -r 8000 -c 1 -b 8 -A file.alaw
- Raw GSM, mono, 8000 Hz (.gsm)
    sox file.wav -t raw -r 8000 -c 1 -b 8 -g file.gsm
    (not all versions of sox support this conversion)
- SUN/SGI audio/basic file, mono 8000 Hz (.au) containing:
    - Signed linear
 ... 						
						

Adding Additional Disk Drives to CentOS 5/6

Making use of a second drive for extra space? Here's a quick run-down: 1) Make sure you know which disk is being formatted. First, second, and third drives will be /dev/sda, /dev/sdb, and /dev/sdc respectively. Check this with fdisk -l
[03:50:04] [[email protected] ~]# fdisk -l

Disk /dev/sda: 34.3 GB, 34359738368 bytes
255 heads, 63 sectors/track, 4177 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2        ... 						
						

Killing zombie process

Zombie process is an inactive computer process, according to wikipedia article, "...On Unix operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table, allowing the process that started it to read its exit status. In the term's colorful metaphor, the child process has died but has not yet been reaped..." So how do I find out zombie process? Use top or ps command: # top OR # ps aux | awk '{ print $8 " " $2 }' | grep -w Z Output: Z 4104 Z 5320 Z 2945 How do I kill zombie process? You cannot kill zombies, as they are already dead. But if you have too many zombies then kill parent process or restart service. You can kill zombie process using PID obtained from any one of the above command....

Find and Change File Permissions Recursively, Linux / UNIX

To find all files in /home/user/demo directory, enter: $ find /home/user/demo -type f -print To find all files in /home/user/demo directory with permission 777, enter: $ find /home/user/demo -type f -perm 777 -print Finally, apply new permission using the -exec option as follows: $ find /home/user/demo -type f -perm 777 -print -exec chmod 755 {} \; To select directories and subdirectories use the following syntax: $ find /home/user/demo -type d -perm 777 -print -exec chmod 755 {} \;...

extract .xz format Linux

If the file is just something.xz (without .tar) then use
unxz something.xz
Otherwise use
*.tar.bz2)	tar xvjf filename.tar.bz2) ;;
*.tar.gz)	tar xvzf filename.tar.gz) ;;
*.tar.xz)	tar Jxvf filename.tar.xz) ;;
*.bz2)		bunzip2 filename.bz2) ;;
*.rar)		unrar filename.rar) ;;
*.gz)		gunzip filename.gz) ;;
*.tar)		tar xvf filename.tar) ;;
*.tbz2)		tar xvjf filename.tbz2) ;;
*.tgz)		tar xvzf filename.tgz) ;;
*.zip)		unzip filename.zip) ;;
*.Z)		uncompress filename.Z) ;;
*.7z)		7z filename.7z) ;;
 ...

Delete Files Older Than x Days on Linux

Delete Files Older Than x Days on Linux The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We’ll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them.   Command Syntax
find /path/to/files* -mtime +5 -exec rm {} \;
Note that there are spaces between rm, {}, and \; Explanation
  • The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
  • The second argument, -mtime, is used to specify the number of days...