Recently in Technical: Beginners Category
Sometimes you would like a quick and easy way to export all MySQL databases from the command line to avoid all of the hassles of web interfaces and an array of tools.
From the command line you can just run this:
mysqldump —user=mysqlusername —password=yourpassword —all-databases > filename.sql
Easy.
Remember - this with everything on this site is for reference only and I’m not responsible for you etc…
This useful command will find all files where a given string, word, value etc is contained within the file. It will search recursively through all directories from where you are presently within the file system:
find RANGE -iname ‘RULES’ | xargs grep ‘STRING’ -GREP_ARGUMENTS
- RANGE = where you are searching. Using a . (full stop) will search all from where you presently are
- RULES = elements of a filename. For instance, ‘*.doc’ will only look through files ending in .doc - * is used as a wildcard
- STRING = the needle in the haystack that we are looking for
Typical Grep Arguments Used
- -s is the same as —no-messages. From man grep: “Suppress error messages about nonexistent or unreadable files.”
- -l, —files-with-matches. From man grep: “Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match.” Basically this just outputs the filename.
- See man grep for more
The Final Result Example (I tend to use this a lot):
find . -iname ‘*php’ | xargs grep ‘needle’ -sl
This looks for the value ‘needle’ in php files only and will only display the file names.
Here are a few notes about BT ISDN 2e (BRI) lines that when I was first learning about phone systems configuration could really have done with being laid out. I hope it helps somebody in the UK (I’m assuming that this kit isn’t available in its exact form elsewhere).
- There are two types of ISDN line offered by BT: BRI and PRI (ISDN 30).
- BT’s ISDN 2e is BRI
- This is the same standard known as EuroISDN
- Each box on the wall supports two channels (lines)
- There are two RJ-45 connectors in the bottom of the present units. These exist so that you can plug two handsets directly into the box. (These are not standard PSTN handsets. The jacks are different - don’t try and force them!)
- Each RJ45 socket carries both lines i.e. you only need to plug in one of them for a PBX
- The type of cable required to fix in here is a standard Cat5 cable (or above).
Just a shot note as this is something that I’ve been asked about recently. Hopefully the distinction I make below will help a beginner somewhere!
To restart apache from the command line, the command is (typically):
sudo /etc/init.d/apache2 restart
There are some errors that you may get whilst running various commands. Below are a list of commands, associated errors and their explanations;
/etc/init.d/apache2 restart
You may get an error for not using ‘sudo’
sudo /etc/init.d/apache2 restart
Not in sudoers file
Your user must have appropriate sudo priveledges
apache2 restart
or sudo apache2 restart
Usage: apache2 [-D name] [-d directory] [-f file]
[-C “directive”] [-c “directive”]
…etc…
Typically this error will occur if you have navigated to the /etc/init.d directory. *This will not work!*
apache2 -k restart
apache2: bad user name ${APACHERUNUSER}
You don’t need to put the -k in. Also see above if you are trying this having navigated to the /etc/init.d directory