Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, December 1, 2014

linux: make a symbolic link to a directory

From command line this give you a link to a folder:

ln -s /home/user/workspace/original_folder_to_link/ /var/www/linked_folder

Bye...

Monday, October 28, 2013

Debian Wheezy: resize/scale images from command line.

First of all you need to have installed imagemagick.
If no, install it from terminal as root so:

apt-get install imagemagick

Now you are ready to convert input.jpg file into output.jpg file for a 1000 pixels of width and 500 pixels of height....

convert -scale 1000x500 input.jpg output.jpg 

The scale method, in this case, depends of the height and the weight of your image.
So if your image is 2 pixels of width and 1 pixels of height the perform will gone exactly.

Differently the perform will be approximated.

If you want to force the scale performing to make a image of gived dimensions...

convert -scale 1000x500! input.jpg output.jpg

If you have multiple files to convert use this:

for i in $( ls *.JPG); do convert -resize 1300x500 $i $i; done
 
Bye.

Wednesday, October 23, 2013

Debian Wheezy: mounting windows shared folder

First of all install cifs-utils smbclient packets, to browse and mount net folders..
So from command line:
apt-get install smbclient cifs-utils

Then you need to create a local folder to map remote folder
mkdir /home/username/example_folder

Then you can mount the remote folder by executing this:
mount -t cifs -o username=remote_pc_username //remote_pc_ip_address/remote_folder_shared_name /home/username/example_folder

Where:
remote_pc_username is the username of remote pc
remote_pc_ip_address is the remote ip address
remote_folder_shared_name is the name that the shared folder has into the local net.

Example 2:
mount -t cifs -o username=pippo //192.168.1.2/shared /home/pluto/example_folder


Terminal will prompts to you the password request....
Give it and then you will have correctly mapped your remote folder into your local example_folder


Bye..


Wednesday, October 16, 2013

Linux: search a file

Simply and fast..... if you are searching a file that you have absolutely forget the path, you can run this by terminal:

locate yourfilename.txt

Important: locate use an indexed system of file research.
For mantains this system update you have to execute periodically this command from terminal....

updatedb

Bye..

Thursday, October 3, 2013

Linux: how to check ram usage

This is quickly command to check ram available on you system...
From terminal execute:

free -k

This command extract info from the /proc/meminfo file.
So if you open this file you see a complete set of information about your system memory.

Bye..

Linux: symbolic link(shortcut) from terminal

From terminal exceute:

ln -s /full_path_whereyouwanttopoint /full_path_alias_command_name

Bye...

Tuesday, April 2, 2013

Manage mdf and mds files with Debian

Recently a downloaded a couple of files(mdf and mds) referred to a cd image.

I need now to write or mount it. In my case to write.

I use acetoneiso to manage those files.

So I get it....

apt-get install acetoneiso

After, when I launch the application, and I select the files, a popup(of the acetoneiso application) inform the it's necessary install a plug-in, puretone, to manage mdf/mds files. The plug-in is proprietary but free.
At the and of the installation, with the menubar button "Image Conversion" I convert the two files in a newer .iso file, and after I burn my cd....

Have fun...

Wednesday, January 23, 2013

What Linux version I have?

For Linux:

cat /etc/you_distribution_name_version

.....if you have Debian, for example....

cat /etc/debian_version

Bye...

Thursday, February 2, 2012

Linux: mounting an iso image - at booting...

Differently to the previous post,
now we proceed to setup the system to auto mount an iso image at the system booting....
Suppose you have an iso image file:

/home/user/your_cd_or_dvd_backup.iso

Create a directory:

mkdir /home/user/your_backup

Open the file /etc/fstab and add the current row:


/home/user/your_cd_or_dvd_backup.iso  /home/user/your_backup udf,iso9660 loop 00
 
This row provides to auto-mount the iso file every time you restart the system.

Bye.

Linux: mounting an iso image - one shot....

Suppose you have an iso file:

/home/user/your_cd_or_dvd_backup.iso

Create a directory:

mkdir /home/user/your_backup

and as root execute the following command to mount it:

mount -o loop /home/user/your_cd_or_dvd_backup.iso /home/user/your_backup


Bye


Thursday, October 6, 2011

Recursively dos2unix....

Recusrsively dos2unix for all file in the current folder and all subfolders....

find ./ -type f -exec dos2unix '{}' \;



Bye...

Search and replace a string, recursively..... under linux

Under linux.....

sed -i 's/stringA/stringB/g' *
 
replace stringA with stringB in all files under current directory....
Recursively way.....
find ./ -type f -exec sed -i 's/stringA/stringB/g' '{}' \; 
 
Bye... 

Thursday, September 1, 2011

MySQL: install as deamon, for start/stop at system startup/shutdown (under CentOS 5.6 64 bit)

Go under mysql execution commands directory....:
cd /usr/bin/
Create startupMysql.sh file with the follow code:
#!/bin/bash
/etc/init.d/mysqld start
Create shutdownMysql.sh file with the follow code:
#!/bin/bash
/etc/init.d/mysqld stop
Give to them the execution privileges only for root
chmod 700 startupMysql.sh
chmod 700 shutdownMysql.sh
Choose the your "favourite" rcXXX.d directory (depends to your configuration)
to put into your deamon startup/shutdown commands.
I choose rc5.d, so:
cd /etc/rc5.d
and give the following ln -s commands:
ln -s /usr/bin/startup_mysqld.sh S100startupMysql
ln -s /usr/bin/shutdown_mysqld.sh K100shutdownMysql
Your deamon startup/shutdown commands are done well...
Now clean up the mysql log file(you find it into /etc/my.cnf), usually /var/log/mysqld.log
cd /var/log
echo "" > mysqld.log
to check, if at the system restart, you mysql restart too.
Restart the system.....:
shutdown -r now

Byw


Thursday, July 14, 2011

Join and split pdf files under linux with pdftk

Install pdftk
apt-get install pdftk

then to merge, example command is:
pdftk test1.pdf test2.pdf cat output test_output.pdf

to split(from page 1 to 5)
pdftk test_output.pdf cat 1-5 output test_output2.pdf


official site link: www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
official site quick examples link: www.pdflabs.com/docs/pdftk-cli-examples/


Bye...