This tutorial section of Single Purpose Terminal Comamnds are intended for complex configurations of linux command tied togeather. Other tutorials give examples of how to use the commands. This tutorial is intended for goal oriented objectives. As it grows it is intended to be catogorized by topic.
Table of Contents
-
Searching: Finding and Replacing
-
File System: Administring Windows Shares
-
Pulse Audio Loopback Monitor Microphone Input
Resource Gathering
Searching: Find a text match inside a file matching extenion
Use grep to display the matching line for each file in current directory matching the extension *.ext
-
grep searchTerm $(find . -name "*.ext")
Searching: Find all files, then text match each file
Use find to to search for all files matching extension, then for each file run grep. This does not display file name.
-
find . -name "*.ext" -exec grep searchTerm {} \;
Recursively Grep
Use grep to create its own file listing. Where .ext is the extension of the file.
-
grep -r --include="*.ext" searchTerm
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
Multi segmented downloader, Axel, Accelerates Downloads between multiple connections.
Axel tries to accelerate HTTP/FTP downloading process by using multiple connections for one file. It can use multiple mirrors for a download. Axel has no dependencies and is lightweight, so it might be useful as a wget clone on byte-critical systems.
-
sudo apt-get install axel
Use axel to create 3 connection maxed out at a combined speed of 5242880 bytes/sec, or 5120 kbtyes/sec, or 5 Mbyes/sec, or 8 MBit. (This is way fast for internet, reasonable for 100baseT)
Use multiple mirrors
axel -n 3 -s 5242880 http://download.com/my.iso
File System Administration:
Administring Windows Shares
Use /etc/fstab to mount a Windows Domain Network Share (using CIFS, aka samba)
Copy and paiste the following one at a time. This is intended to be ran as a script, this is the reason for the sudo su workaround.
-
sudo apt-get install dialog -y
-
sudo su
-
export windowsUsername=`dialog --stdout --inputbox windowsUsername 20 30 mintUser`;
-
export windowsPassword=`dialog --stdout --inputbox windowsPassword 20 30 guest`;
-
export serverHostname=`dialog --stdout --inputbox serverHostname 20 30 192.168.0.1`;
-
export shareName=`dialog --stdout --inputbox "shareName" 20 30 Public`;
-
export credentialsLocation=`dialog --stdout --inputbox "Credentials File Location" 20 30 /root/.creds`;
-
export mintUsername=`dialog --stdout --inputbox "Linux Mint Username" 20 30 mint`;
-
dialog --infobox "Making the Credentials File" 20 30;
-
echo "username=$windowsUsername" > $credentialsLocation;
-
echo "password=$windowsPassword" >> $credentialsLocation;
-
dialog --infobox "Making the folders for share" 20 30;
-
mkdir /home/$mintUsername/Servers;
-
mkdir /home/$mintUsername/Servers/$shareName;
-
echo --infobox "Writing to /etc/fstab" 20 30;
-
echo "//$serverHostname/$shareName /home/$mintUsername/Servers/$shareName cifs rw,credentials=$credentialsLocation,uid=1000 0 0" >> /etc/fstab;
-
umount /home/$mintUsername/Servers/*
-
chown -Rv $mintUsername:$mintUsername /home/$mintUsername/Servers;
-
mount -a
Fix Apache Permissions for Joomla 1.6 or PHP suggested
Find can be used to repair the apache htdocs directory (aka html).
-
chown root:apache -R /var/www/html
-
cd /var/www/html
-
find . -type f -exec chmod 644 {} \;
-
find . -type d -exec chmod 775 {} \;
-
find . -type f -name "configuration.php" -exec chmod 664 {} \;
-
find . -type f -name "*.ini" -exec chmod 664 {} \;
-
find . -type f -name "*.css" -exec chmod 664 {} \;
-
find . -type f -name ".htaccess" -exec chmod 755 {} \;
Hardware:
Pulse Audio Loopback Monitor (hear) Microphone Input.
Tested on Linux Mint 11
Open the Menu >> Preferences >> Sound, Set Hardware Profile to : Analog Sterio Duplex. Set Input Connector: Analog Microphone at Unamplified Volume
Test the settings first, Will only work for this Restart/Session?
-
pactl load-module module-loopback
Write the configuration while execuiting the bourne shell command as root.
-
sudo sh -c ' echo "load-module module-loopback" >> /etc/pulse/default.pa '