find . -type f -name "*.xml" | xargs -i mv {}
This is my cheat sheet if I have to look back for an answer for problems. You're welcome to add or comment the answer.
Thursday, January 5, 2012
Linux moving or deleting large files getting Argument List Too Long
When you try to move or delete a lot of files in linux cli and getting Argument List Too Long, you can try to filter it by
find . -type f -name "*.xml" | xargs -i mv {}
find . -type f -name "*.xml" | xargs -i mv {}
Wednesday, January 4, 2012
Mysql Export and Import from select statement
To export into a csv file from a select statement in mysql, the command is
SELECT * INTO OUTFILE 'data.txt'
FIELDS TERMINATED BY ','
FROM table2;
To read the comma-delimited file back in, the correct statement would be:
LOAD DATA INFILE 'data.txt' INTO TABLE table2
FIELDS TERMINATED BY ',';
SELECT * INTO OUTFILE 'data.txt'
FIELDS TERMINATED BY ','
FROM table2;
To read the comma-delimited file back in, the correct statement would be:
LOAD DATA INFILE 'data.txt' INTO TABLE table2
FIELDS TERMINATED BY ',';
Tuesday, December 13, 2011
Moodle sort courses by name did not work
When you try to sort courses in Moodle and the order is not really working, it means that your sortorder has reach the max number.
To fix it, simply go to the mysql and apply this command to the database
mysql> UPDATE mdl_course SET sortorder = 1000;
This will reset all courses sortorder and simply run it again to resort your courses.
To fix it, simply go to the mysql and apply this command to the database
mysql> UPDATE mdl_course SET sortorder = 1000;
This will reset all courses sortorder and simply run it again to resort your courses.
Wednesday, November 30, 2011
Moodle backup error with fatal memory issue
To avoid this memory issue, increase the memory site on the config.php
Add this line
$CFG->extramemorylimit = '4096M';
Log out from the moodle and close the browser. Then open the page again and log in.
If you still run into the issue, increase the memory limit to bigger value. Once you are done, be sure to remove the line.
Add this line
$CFG->extramemorylimit = '4096M';
Log out from the moodle and close the browser. Then open the page again and log in.
If you still run into the issue, increase the memory limit to bigger value. Once you are done, be sure to remove the line.
Saturday, October 15, 2011
Import csv into mysql direct
load data local infile 'uniq.csv' into table tblUniq
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(uniqName, uniqCity, uniqComments)
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(uniqName, uniqCity, uniqComments)
Wednesday, September 21, 2011
How to use screen in cli
To start a new screen session, simply type the word "screen" and hit enter. It is preferred that you name your screen session, by instead using "screen -t name".
To "detach" from a screen session, type "Control+A", then "D".
To terminate a screen session, type "exit" and hit enter.
To list currently running screen sessions, type "screen -ls" and hit enter.
To "reattach" a screen session, type "screen -r [name of socket]" and hit enter.
"[name of socket]" is one of the sockets listed from the "screen -ls" command.
To scroll back through console output within a screen session: ctrl-a (release) then type [ Use the up and down arrows. To escape this mode (copy mode) hit esc
To "detach" from a screen session, type "Control+A", then "D".
To terminate a screen session, type "exit" and hit enter.
To list currently running screen sessions, type "screen -ls" and hit enter.
To "reattach" a screen session, type "screen -r [name of socket]" and hit enter.
"[name of socket]" is one of the sockets listed from the "screen -ls" command.
To scroll back through console output within a screen session: ctrl-a (release) then type [ Use the up and down arrows. To escape this mode (copy mode) hit esc
Monday, September 12, 2011
Showing tables only in mysql
To show only tables and dump to a txt, use the command
# mysqlshow database_name > export.txt
# mysqlshow database_name > export.txt
Subscribe to:
Posts (Atom)