To find the most recently modified files, sorted in the reverse order of update time (i.e., the most recently updated files first):
$ find /etc -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r
To search for files in /target_directory and all its sub-directories, that have been modified in the last 60 minutes:
$ find /target_directory -type f -mmin -60
This is very handy especially when looking for an error on a system.
Tuesday, May 31, 2016
Thursday, November 3, 2011
How to set different permissions for subfiles and subdirectories
To give different permission settings for all subdirectories and subfiles use following commands:
find /start/location/ -type f -print0 | xargs -0 chmod 644
find /start/location/ -type d -print0 | xargs -0 chmod 755
If you receive such an error "permission denied", run above commands as root with "su" parameter or try them as following:
sudo find /start/location/ -type f -print0 | sudo xargs -0 chmod 644
sudo find /start/location/ -type d -print0 | sudo xargs -0 chmod 755
In here permission settings of all subfiles will be changed to "644" and all subdirectories will be changed to "755".
find /start/location/ -type f -print0 | xargs -0 chmod 644
find /start/location/ -type d -print0 | xargs -0 chmod 755
If you receive such an error "permission denied", run above commands as root with "su" parameter or try them as following:
sudo find /start/location/ -type f -print0 | sudo xargs -0 chmod 644
sudo find /start/location/ -type d -print0 | sudo xargs -0 chmod 755
In here permission settings of all subfiles will be changed to "644" and all subdirectories will be changed to "755".
Saturday, July 9, 2011
Some useful Linux commands & tips
1) List users with cat or awk in a system
2) Count the results with the pipe wc -l
Above commands can be rewritten as following
3) Grep command
Recursively search "some_string" only in python files in home directory
cat /etc/passwd | cut -d: -f 1,3,6 | grep "[5-9][0-9][0-9]" | grep "/home" | cut -d: -f1
awk -F: '$6 ~ /\/home/ && $3 >= 500 {print $1}' /etc/passwd2) Count the results with the pipe wc -l
Above commands can be rewritten as following
cat /etc/passwd | cut -d: -f 1,3,6 | grep "[5-9][0-9][0-9]" | grep "/home" | cut -d: -f1 | wc -l
awk -F: '$6 ~ /\/home/ && $3 >= 500 {print $1}' /etc/passwd | wc -l3) Grep command
Recursively search "some_string" only in python files in home directory
grep -r --include="*.py" "some_string" /homeDisplay the process containing "some_string"
ps aux | grep "some_string"
Thursday, June 9, 2011
Reverse Engineering: Developing a device driver for Linux
Reverse engineering is the most used way to develop a device driver for Linux. If you are interested to write a program to support your unknown driver in Linux, at least you need an average programming capability in C language.
Some useful links:
Introduction to Reverse Engineering Software
www.acm.uiuc.edu/sigmil/RevEng
Learning how to reverse engineer a Windows USB driver
www.jespersaur.com/drupal/book/export/html/21
Some useful links:
Introduction to Reverse Engineering Software
www.acm.uiuc.edu/sigmil/RevEng
Learning how to reverse engineer a Windows USB driver
www.jespersaur.com/drupal/book/export/html/21
Processing: Web-cam capturing in Linux
Processing is an open source and cross-platform programming language and integrated development environment (IDE). It is especially used for teaching the basics of computer programming.
Website:
http://processing.org
To capture a web-cam with processing there is a standard video library.
However it requires pre-installation of Quicktime and WinVDIG.
It seemed quite difficult for me to run this way video capturing in Linux.
Finaly I found an additional library GSVideo.
Website:
http://gsvideo.sourceforge.net
It works very similar to the standard video library. Plus it does not require pre-installation of Quicktime & WinVDIG, and works in Linux platform as well.
Below simple example shows the differences of standard video library and GSVideo library.
// Capturing web-cam with standard video library.
// It requires pre-installation of QuickTime and WinVDIG.
// Hard to use in Linux platform.
import processing.video.*;
Capture camera;
void setup(){
size(320, 240);
camera = new Capture(this, 320, 240, 12);
}
void draw(){
image(camera, 0, 0);
}
void captureEvent(Capture camera){
camera.read();
}
// Capturing with GSVideo library works cross-platform.
// It only requires additional GSVideo library as below directory order;
// <processing>/sketchbook/libraries/GSVideo
// Visit gsvideo.sourceforge.net for reference information.
import codeanticode.gsvideo.*;
GSCapture camera;
void setup(){
size(320, 240);
camera = new GSCapture(this, 320, 240);
camera.play();
}
void draw(){
image(camera, 0, 0);
}
void captureEvent(GSCapture camera){
camera.read();
}
Website:
http://processing.org
To capture a web-cam with processing there is a standard video library.
However it requires pre-installation of Quicktime and WinVDIG.
It seemed quite difficult for me to run this way video capturing in Linux.
Finaly I found an additional library GSVideo.
Website:
http://gsvideo.sourceforge.net
It works very similar to the standard video library. Plus it does not require pre-installation of Quicktime & WinVDIG, and works in Linux platform as well.
Below simple example shows the differences of standard video library and GSVideo library.
// Capturing web-cam with standard video library.
// It requires pre-installation of QuickTime and WinVDIG.
// Hard to use in Linux platform.
import processing.video.*;
Capture camera;
void setup(){
size(320, 240);
camera = new Capture(this, 320, 240, 12);
}
void draw(){
image(camera, 0, 0);
}
void captureEvent(Capture camera){
camera.read();
}
// Capturing with GSVideo library works cross-platform.
// It only requires additional GSVideo library as below directory order;
// <processing>/sketchbook/libraries/GSVideo
// Visit gsvideo.sourceforge.net for reference information.
import codeanticode.gsvideo.*;
GSCapture camera;
void setup(){
size(320, 240);
camera = new GSCapture(this, 320, 240);
camera.play();
}
void draw(){
image(camera, 0, 0);
}
void captureEvent(GSCapture camera){
camera.read();
}
It worked very well for me.
Hope this post helps someone else in similar case :)
Friday, June 3, 2011
Display or print Japanese fonts within a pdf file in Ubuntu/Linux Distribution
I had a problem to display/print Japanese fonts in a pdf file in my Ubuntu 10.04 distro. Evince did not display nor print the Japanese fonts. Adobe Reader displayed correctly however it did not print the Japanese fonts.
Installing the package poppler-data fixed those problems. It is available in Ubuntu package manager.
Prior of installing the package poppler-data, I realized that Foxit PDF reader was already rendering the Japanese fonts very well. Therefore I also recommend installing Foxit PDF Reader.
Foxit Reader for Linux:
http://www.foxitsoftware.com/pdf/desklinux/download.html
Installing the package poppler-data fixed those problems. It is available in Ubuntu package manager.
Prior of installing the package poppler-data, I realized that Foxit PDF reader was already rendering the Japanese fonts very well. Therefore I also recommend installing Foxit PDF Reader.
Foxit Reader for Linux:
http://www.foxitsoftware.com/pdf/desklinux/download.html
Monday, January 24, 2011
Choppy Flash playback in full screen [Ubuntu/Linux]
Try these commands:
sudo mkdir /etc/adobe
echo "OverrideGPUValidation=true" >~/mms.cfg
sudo mv ~/mms.cfg /etc/adobe/
Restart the browser.
If that doesn't work, then right-click the flash video, select "Settings", then untick the option "Enable hardware acceleration".
Sources:
http://www.webgapps.org/flash/issues-and-solutions
https://bugs.launchpad.net/ubuntu/+bug/346289
sudo mkdir /etc/adobe
echo "OverrideGPUValidation=true" >~/mms.cfg
sudo mv ~/mms.cfg /etc/adobe/
Restart the browser.
If that doesn't work, then right-click the flash video, select "Settings", then untick the option "Enable hardware acceleration".
Sources:
http://www.webgapps.org/flash/issues-and-solutions
https://bugs.launchpad.net/ubuntu/+bug/346289
Saturday, January 22, 2011
Install Lingoes translator tool in Ubuntu/Linux ... or give it a try to a Linux native dictionary software: Goldendict
1) Install Wine Compatibility Layer (WineHQ):
winetricks should be also installed as default, if not also install winetricks.
2) Install Internet Explorer 7 via winetricks:
Open terminal and type "sh winetricks ie7" then follow the instructions.
3) Copy "mfc42u.dll" file to system and system32 folders:
http://www.dll-files.com/dllindex/dll-files.shtml?mfc42u
4) Download and install Lingoes translator tool (version 2.7.1 tested):
http://www.lingoes.net/en/translator/download.htm
5) Open "Internet Explorer" with Wine and edit "ActiveX Controls" settings:
Tools -> Internet Options -> Security
Click "Custom Level" for "Internet" zone and enable ActiveX Controls
Enable "Download signed ActiveX Controls"
Probably Internet Explorer will not be your default Internet browser in Linux, therefore security warnings due to those settings might not be so important.
6) You may also install the fonts like following way:
sh winnetricks fakejapanese
sh winnetricks fakekorean
sh winnetricks fakechinese
7) You can add speech functionality, if you like:
Go to http://www.lingoes.net/en/translator/speech.htm and follow the instructions.
Except hot-keys and text capturing from the screen Lingoes might work well.
GoldenDict:
GoldenDict is a great dictionary software and natively supported in Linux Distributions.
Supported dictionary files:
GoldenDict official website:
http://goldendict.org
winetricks should be also installed as default, if not also install winetricks.
2) Install Internet Explorer 7 via winetricks:
Open terminal and type "sh winetricks ie7" then follow the instructions.
3) Copy "mfc42u.dll" file to system and system32 folders:
http://www.dll-files.com/dllindex/dll-files.shtml?mfc42u
4) Download and install Lingoes translator tool (version 2.7.1 tested):
http://www.lingoes.net/en/translator/download.htm
5) Open "Internet Explorer" with Wine and edit "ActiveX Controls" settings:
Tools -> Internet Options -> Security
Click "Custom Level" for "Internet" zone and enable ActiveX Controls
Enable "Download signed ActiveX Controls"
Probably Internet Explorer will not be your default Internet browser in Linux, therefore security warnings due to those settings might not be so important.
6) You may also install the fonts like following way:
sh winnetricks fakejapanese
sh winnetricks fakekorean
sh winnetricks fakechinese
7) You can add speech functionality, if you like:
Go to http://www.lingoes.net/en/translator/speech.htm and follow the instructions.
Except hot-keys and text capturing from the screen Lingoes might work well.
GoldenDict:
GoldenDict is a great dictionary software and natively supported in Linux Distributions.
Supported dictionary files:
- Babylon .BGL files,
- StarDict .ifo/.dict./.idx/.syn dictionaries,
- Dictd .index/.dict(.dz) dictionary files, and more.
GoldenDict official website:
http://goldendict.org
Friday, September 10, 2010
Playing with Django 0.96 - Class Meta & Class Admin
>>> for m in ModelName._meta.__dict__:
... m
...
'unique_together'
'order_with_respect_to'
'installed'
'auto_field'
'has_auto_field'
'many_to_many'
'ordering'
'one_to_one_field'
'object_name'
'parents'
'db_tablespace'
'pk'
'verbose_name'
'get_latest_by'
'db_table'
'permissions'
'admin'
'fields'
'verbose_name_plural'
'app_label'
'module_name'
'aka'
>>> for m in ModelName._meta.admin.__dict__:
... m
...
'list_select_related'
'save_as'
'save_on_top'
'list_per_page'
'ordering'
'fields'
'list_display'
'search_fields'
'js'
'date_hierarchy'
'list_filter'
'list_display_links'
'manager'
... Class Admin:
... list_select_related = True
... list_per_page = 20
... manager = MyAdminManager()
Class MyAdminManager(models.Manager):
... def get_query_set(self):
... query_set = super(MyAdminManager, self).get_query_set().filter(id__gte=5)
... return query_set
... m
...
'unique_together'
'order_with_respect_to'
'installed'
'auto_field'
'has_auto_field'
'many_to_many'
'ordering'
'one_to_one_field'
'object_name'
'parents'
'db_tablespace'
'pk'
'verbose_name'
'get_latest_by'
'db_table'
'permissions'
'admin'
'fields'
'verbose_name_plural'
'app_label'
'module_name'
'aka'
>>> for m in ModelName._meta.admin.__dict__:
... m
...
'list_select_related'
'save_as'
'save_on_top'
'list_per_page'
'ordering'
'fields'
'list_display'
'search_fields'
'js'
'date_hierarchy'
'list_filter'
'list_display_links'
'manager'
... Class Admin:
... list_select_related = True
... list_per_page = 20
... manager = MyAdminManager()
Class MyAdminManager(models.Manager):
... def get_query_set(self):
... query_set = super(MyAdminManager, self).get_query_set().filter(id__gte=5)
... return query_set
Thursday, July 22, 2010
Avidemux : Crossplatform free video editor
Avidemux is crossplatform free video editor.
Split, cut and remove the unwanted scenes, join or convert your video files without any hassle.
Download links:
http://download.cnet.com/Avidemux/3000-13631_4-10829933.html
http://fixounet.free.fr/avidemux/
Split, cut and remove the unwanted scenes, join or convert your video files without any hassle.
Download links:
http://download.cnet.com/Avidemux/3000-13631_4-10829933.html
http://fixounet.free.fr/avidemux/
Friday, June 25, 2010
Fan speed control of a Dell PC in Linux Distrubition
1. Install gkrellm application from the package manager or the link below:
http://linuxappfinder.com/package/gkrellm
2. Install gkrellm-i8k or i8kutils plugins:
Here the links for download, you can also search them from your package manager:
* Debian package - gkrellm-i8k_2.5-1_i386.deb
http://packages.debian.org/lenny/i386/gkrellm-i8k/download
* Red Hat package - i8kutils-1.25-16.i586.rpm
http://fr.rpmfind.net/linux/rpm2html/search.php?query=i8krellm.so
3. Then try following:
Type in terminal sudo modprobe i8k force=1
Edit /etc/modulesand add i8k force=1 to the end of the file.
Another way if /etc/modules does not exist is editing the file /etc/rc.local and adding modprobe i8k force=1
You may also need to configure your GKrellM application for Dell I8K Plugin.
http://linuxappfinder.com/package/gkrellm
2. Install gkrellm-i8k or i8kutils plugins:
Here the links for download, you can also search them from your package manager:
* Debian package - gkrellm-i8k_2.5-1_i386.deb
http://packages.debian.org/lenny/i386/gkrellm-i8k/download
* Red Hat package - i8kutils-1.25-16.i586.rpm
http://fr.rpmfind.net/linux/rpm2html/search.php?query=i8krellm.so
3. Then try following:
Type in terminal sudo modprobe i8k force=1
Edit /etc/modulesand add i8k force=1 to the end of the file.
Another way if /etc/modules does not exist is editing the file /etc/rc.local and adding modprobe i8k force=1
You may also need to configure your GKrellM application for Dell I8K Plugin.
Wednesday, February 3, 2010
GNU/Linux Advanced Administration
GNU/Linux Advanced Administration PDF Book
http://ftacademy.org/files/materials/fta-m2-admin_gnulinux-v1.pdf
http://ftacademy.org/files/materials/fta-m2-admin_gnulinux-v1.pdf
Saturday, March 21, 2009
Saturday, March 14, 2009
Some linux stuff
httpd.conf
/etc/apache2/httpd.conf
crontab usage
crontab [-u user] file
crontab [-u user] { -e | -l | -r }
(default operation is replace, per 1003.2)
-e (edit user's crontab)
-l (list user's crontab)
-r (delete user's crontab)
-i (prompt before deleting user's crontab)
visudo
List of who can run what
/etc/sudoers
Lock file for visudo
/etc/sudoers.tmp
/etc/apache2/httpd.conf
crontab usage
crontab [-u user] file
crontab [-u user] { -e | -l | -r }
(default operation is replace, per 1003.2)
-e (edit user's crontab)
-l (list user's crontab)
-r (delete user's crontab)
-i (prompt before deleting user's crontab)
visudo
List of who can run what
/etc/sudoers
Lock file for visudo
/etc/sudoers.tmp
Sunday, March 1, 2009
HTML - How to display Turkish characters?
LATIN SMALL LETTER C WITH CEDILLA = ç ==> ç
LATIN CAPITAL LETTER C WITH CEDILLA = Ç ==> Ç
LATIN SMALL LETTER G WITH BREVE = ğ ==> ğ
LATIN CAPITAL LETTER G WITH BREVE = Ğ ==> Ğ
LATIN SMALL LETTER I DOTLESS = ı ==> ı
LATIN CAPITAL LETTER I WITH DOT ABOVE = İ ==> İ
LATIN SMALL LETTER O WITH DIARESIS= ö ==> ö
LATIN CAPITAL LETTER O WITH DIARESIS = Ö ==> Ö
LATIN SMALL LETTER S WITH CEDILLA = ş ==> ş
LATIN CAPITAL LETTER S WITH CEDILLA = Ş ==> Ş
LATIN SMALL LETTER U WITH DIARESIS= ü ==> ü
LATIN CAPITAL LETTER U WITH DIARESIS = Ü ==> Ü
Monday, February 2, 2009
Adding FTP users outside of Plesk
To add a chrooted FTP user outside of Plesk properly, you need to:
* Create the user with the home directory as the root of what they can access
* Give the user a password
* Make their primary group psacln
* Add them to the psaserv group as well
# useradd username -d /var/www/html/website/slideshow/
# echo "password" | passwd username --stdin
Changing password for user username.
passwd: all authentication tokens updated successfully.
# usermod -g psacln username
# usermod -G psaserv username
# lftp username:password@localhost
lftp username@localhost:/> cd ..
lftp username@localhost:/>
http://rackerhacker.com/2007/04/27/adding-chrooted-ftp-users-outside-of-plesk/
Saturday, January 17, 2009
Make split .rar files Ubuntu Linux
To compress file(s) to split rar archive know which directory you want to compress, I used /home as an example
Let me break the above command down
rar - starts the program
a - tells program to add files to the archive
-m5 - determine the compression level (0-store (fast)...3-default...5-maximum(slow))
-v5M - determine the size of each file in split archive, in this example you get files with size 5MB (if you wanted files of 512kB size you would write -v512k)
myarchive - name of the archive you are creating
/home/ - is folder of the files you wish to add to the archive
More details;
rar a -m5 -v5M -R myarchive /home/
Let me break the above command down
rar - starts the program
a - tells program to add files to the archive
-m5 - determine the compression level (0-store (fast)...3-default...5-maximum(slow))
-v5M - determine the size of each file in split archive, in this example you get files with size 5MB (if you wanted files of 512kB size you would write -v512k)
myarchive - name of the archive you are creating
/home/ - is folder of the files you wish to add to the archive
More details;
Subscribe to:
Posts (Atom)