AirV's Blog

Just another blog

Commande Macintosh

Raccourcis claviers sous Mac OS X

From HowToGeek.com :

Mastering the keyboard will not only increase your navigation speed but it can also help with wrist fatigue. Here are some lesser known OS X shortcuts to help you become a keyboard ninja.

After our article last week covering keyboard shortcuts for Windows that you might be unaware of, we had lots of requests for the best OS X shortcuts as well, so we’ve compiled a list of shortcuts you may or may not be aware of.

Image by Daniel Novta.

Global Menu Shortcuts

Fn-Arrow Keys is the equivalent of the Home/End and PageUp/PageDown buttons on a PC; Left-arrow and right-arrow for Home and End, Up-arrow and down-arrow for PageUp and PageDown.

Fn-Delete deletes one character to the right of the cursor, same as forward-delete on a PC.

Ctrl-F2 moves focus to the Menubar. You can use the arrow keys to select menu items and enter to apply them.

Ctrl-F3 moves focus to the Dock. You can navigate around with the arrow keys to select applications and enter to switch to them.

Ctrl-Cmd-D displays a popup dictionary for a selected word. Just hover over the word with the cursor and hit the shortcut. Useful for quick definitions.

Cmd-Q quits the current application.

Opt-Cmd-Escape opens the force quit menu where you can selectively force quit applications.

Holding Shift-Cmd-Opt-Esc for three seconds force quits the frontmost application (Leopard and Snow Leopard only).

Ctrl-Eject opens the shutdown/restart/sleep dialogue.

Ctrl-Shift-Eject puts the display to sleep immediately.

Opt-Cmd-Eject puts the computer to sleep immediately.

Ctrl-Opt-Cmd-Eject shuts down the computer immediately.

Finder Shortcuts

Enter renames selected file.

Cmd-O opens the selected folder in the Finder.

Shift-Cmd-N creates a new folder in the current directory.

Cmd-J opens the View Options panel, where you can tweak settings for how a specific folder appears in the Finder, such as icon size.

Cmd-I opens the Get Info panel for the selected item.

Cmd-Delete sends selected file(s) to Trash.

Shift-Cmd-Delete empties the Trash with confirmation.

Shift-Opt-Cmd-Delete empties the Trash without confirmation.

How to add a user from the MacOs command line

From osxdaily.com

Create a new entry in the local (/) domain under the category /users.
dscl / -create /Users/toddharris

Create and set the shell property to bash.
dscl / -create /Users/toddharris UserShell /bin/bash

Create and set the user’s full name.
dscl / -create /Users/toddharris RealName "Dr. Todd Harris"

Create and set the user’s ID.
dscl / -create /Users/toddharris UniqueID 503

Create and set the user’s group ID property.
dscl / -create /Users/toddharris PrimaryGroupID 1000

Add to another group
dscl / -append /Groups/admin GroupMembership rozec

Create and set the user home directory.
dscl / -create /Users/toddharris NFSHomeDirectory /Local/Users/toddharris

Set the password.
dscl / -passwd /Users/toddharris PASSWORD

or

passwd toddharris

If you would like Dr. Harris to be able to perform administrative functions:
dscl / -append /Groups/admin GroupMembership toddharris

Read the user’s information:
dscl / -read /Users/rozec

The local host’s information:
dscl . -read /Users/rozec

Delete the user:
dscl . -delete /Users/rozec

Install Perl modules manually and using CPAN on MacOs

From TheGeekStuff.com :

Installing Perl modules using CPAN is the better solution, as it resolves all the dependencies automatically.
When a Perl module is not installed, application will display the following error message. In this example, XML::Parser Perl module is missing.

Install Perl Modules Manually

Download Perl module

Go to CPAN Search website and search for the module that you wish to download. In this example, let us search, download and install XML::Parser Perl module. I have downloaded the XML-Parser-2.36.tar.gz to /home/download

# cd /home/download
# gzip -d XML-Parser-2.36.tar.gz
# tar xvf XML-Parser-2.36.tar
# cd XML-Parser-2.36
Build the perl module
# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for XML::Parser::Expat
Writing Makefile for XML::Parser
# make
# make test
Install the perl module
# make install

This is very simple for one module with no dependencies. Typically, Perl modules will be dependent on several other modules. Chasing all these dependencies one-by-one can be very painful and annoying task. I recommend the CPAN method of installation as shown below. Use the manual method only if the server is not connected to the Internet.

Install Perl Modules using CPAN automatically

Verify whether CPAN is already installed

To install Perl modules using CPAN, make sure the cpan command is working. You should have the CPAN perl module installed before you can install any other Perl modules using CPAN. In this example, CPAN module is not installed.

# cpan
-bash: cpan: command not found

# perl -MCPAN -e shell
Can't locate CPAN.pm in @INC (@INC contains:
/usr/lib/perl5/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/5.10.0
/usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.0
/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.10.0
/usr/lib/perl5/vendor_perl /usr/lib/perl5/site_perl/5.10.0 .).
BEGIN failed--compilation aborted.
Install the CPAN module using yum
# yum install perl-CPAN

Output of yum install perl-CPAN command:

Loaded plugins: refresh-packagekit
updates-newkey                       | 2.3 kB     00:00
primary.sqlite.bz2                   | 2.4 MB     00:00
Setting up Install Process
Parsing package install arguments

Resolving Dependencies
Transaction Summary
=============================================================================
Install      5 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 1.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): perl-ExtUtils-ParseXS-2.18-31.fc9.i386.rpm     |  30 kB     00:00
(2/5): perl-Test-Harness-2.64-31.fc9.i386.rpm         |  70 kB     00:00
(3/5): perl-CPAN-1.9205-31.fc9.i386.rpm               | 217 kB     00:00
(4/5): perl-ExtUtils-MakeMaker-6.36-31.fc9.i386.rpm   | 284 kB     00:00
(5/5): perl-devel-5.10.0-31.fc9.i386.rpm              | 408 kB     00:00

Installing     : perl-ExtUtils-ParseXS                             [1/5]
Installing     : perl-devel                                        [2/5]
Installing     : perl-Test-Harness                                 [3/5]
Installing     : perl-ExtUtils-MakeMaker                           [4/5]
Installing     : perl-CPAN                                         [5/5]


Installed: perl-CPAN.i386 0:1.9205-31.fc9
Dependency Installed:
  perl-ExtUtils-MakeMaker.i386 0:6.36-31.fc9
  perl-ExtUtils-ParseXS.i386 1:2.18-31.fc9
  perl-Test-Harness.i386 0:2.64-31.fc9
  perl-devel.i386 4:5.10.0-31.fc9
Complete!
Configure cpan the first time

The first time when you execute cpan, you should set some configuration parameters as shown below. I have shown only the important configuration parameters below. Accept all the default values by pressing enter.

Note: Make sure to execute “o conf commit” in the cpan prompt after the configuration to save the settings.

# cpan

Sorry, we have to rerun the configuration dialog for CPAN.pm due
to some missing parameters...

CPAN build and cache directory? [/root/.cpan]
Download target directory? [/root/.cpan/sources]
Directory where the build process takes place? [/root/.cpan/build]

Always commit changes to config variables to disk? [no]
Cache size for build directory (in MB)? [100]
Let the index expire after how many days? [1]

Perform cache scanning (atstart or never)? [atstart]
Cache metadata (yes/no)? [yes]
Policy on building prerequisites (follow, ask or ignore)? [ask]

Parameters for the 'perl Makefile.PL' command? []
Parameters for the 'perl Build.PL' command? []

Your ftp_proxy? []
Your http_proxy? []
Your no_proxy? []
Is it OK to try to connect to the Internet? [yes]

First, pick a nearby continent and country by typing in the number(s)
(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) [] 5

(1) Bahamas
(2) Canada
(3) Mexico
(4) United States
Select your country (or several nearby countries) [] 4

(2) ftp://carroll.cac.psu.edu/pub/CPAN/
(3) ftp://cpan-du.viaverio.com/pub/CPAN/
(4) ftp://cpan-sj.viaverio.com/pub/CPAN/
(5) ftp://cpan.calvin.edu/pub/CPAN
(6) ftp://cpan.cs.utah.edu/pub/CPAN/
e.g. '1 4 5' or '7 1-4 8' [] 2-16

cpan[1]> o conf commit
commit: wrote '/usr/lib/perl5/5.10.0/CPAN/Config.pm'

cpan[2]> quit
No history written (no histfile specified).
Lockfile removed.
Install Perl Modules using CPAN

You can use one of the following method to install a Perl module using cpan.

# /usr/bin/perl -MCPAN -e 'install Email::Reply'

(or)

# cpan
cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)

cpan[1]> install "Email::Reply";

Output of above perl install command:

CPAN: Storable loaded ok (v2.18)
Going to read /root/.cpan/Metadata
Database was generated on Mon, 15 Sep 2008 11:02:52 GMT

Running install for module 'Email::Reply'
Running make for R/RJ/RJBS/Email-Reply-1.202.tar.gz
CPAN: LWP::UserAgent loaded ok (v2.036)
CPAN: Time::HiRes loaded ok (v1.9711)
Fetching with LWP:
ftp://carroll.cac.psu.edu/pub/CPAN/authors/id/R/RJ/RJBS/Email-Reply-1.202.tar.gz

CPAN: checksum security checks disabled because Digest::SHA not installed.
Please consider installing the Digest::SHA module.

CPAN: Compress::Zlib loaded ok (v2.008)
Email-Reply-1.202/
Email-Reply-1.202/Changes
CPAN: File::Temp loaded ok (v0.18)
Warning: prerequisite Email::Abstract 2.01 not found.
Warning: prerequisite Email::MIME::Creator 1.41 not found.
Writing Makefile for Email::Reply
---- Unsatisfied dependencies detected during ----
----       RJBS/Email-Reply-1.202.tar.gz      ----
Email::Abstract [requires]
Email::MIME::Creator [requires]
Shall I follow them and prepend them to the queue

of modules we are processing right now? [yes]
[Note: CPAN automatically detects that Email::Abstract
       and Email::MIME::Creator is required]

Fetching with LWP:
ftp://server/pub/CPAN/authors/id/R/RJ/RJBS/Email-Abstract-2.134.tar.gz
make -- OK
make install  -- OK

Fetching with LWP:
ftp://server/pub/CPAN/authors/id/R/RJ/RJBS/Email-MIME-Creator-1.454.tar.gz
make -- OK
make install  -- OK

Warning: prerequisite Email::Simple::Creator 1.4 not found.
Writing Makefile for Email::MIME::Creator
Email::Simple::Creator [requires]
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]
[Note: CPAN automatically detects that Simple::Creator is required]

Fetching with LWP:
ftp://carroll.cac.psu.edu/pub/CPAN/authors/id/R/RJ/RJBS/Simple-Creator.tar.gz
make -- OK
make install  -- OK

Fetching with LWP:
CPAN.pm: Going to build R/RJ/RJBS/Email-Reply-1.202.tar.gz

make -- OK
make install  -- OK

In the example above, Email::Reply is dependent on the several other modules. CPAN automatically resolves the dependencies and installs Email::Reply and all the dependent Perl modules.

Commandes

  • Re-configure CPAN at any time from the CPAN prompt by issing :

o conf init

  • Enregistrement de la conf :

o conf commit

  • Fichier de conf sous MacOs :

/System/Library/Perl/5.10.0/CPAN/Config.pm

Add User on MacOs

From osxdaily.com :

Adding a user is something easily accomplished using the built in GUI tools that ship with OS X, however any power user can appreciate the possible efficiency gained from using the command line. So in the spirit of efficiency here are the steps necessary to add a user to your Mac OS X system all with our good friend, Terminal.app.

These commands need to be run as either the root user or with the “sudo” command. For more information on the sudo command see the sudo man page.

Create a new entry in the local (/) domain under the category /users.
dscl / -create /Users/toddharris

Create and set the shell property to bash.
dscl / -create /Users/toddharris UserShell /bin/bash

Create and set the user’s full name.
dscl / -create /Users/toddharris RealName « Dr. Todd Harris »

Create and set the user’s ID.
dscl / -create /Users/toddharris UniqueID 503

Create and set the user’s group ID property.
dscl / -create /Users/toddharris PrimaryGroupID 1000

Create and set the user home directory.
dscl / -create /Users/toddharris NFSHomeDirectory /Local/Users/toddharris

Set the password.
dscl / -passwd /Users/toddharris PASSWORD

or

passwd toddharris

If you would like Dr. Harris to be able to perform administrative functions:
dscl / -append /Groups/admin GroupMembership toddharris

Installation d’un DMG sur MacOs

Pour installer un DMG en ligne de commandes :
cd ~/Desktop
curl -O http://darwinports.opendarwin.org/downloads/DarwinPorts-1.2-10.4.dmg
hdiutil attach DarwinPorts-1.2-10.4.dmg
cd /Volumes/DarwinPorts-1.2/
sudo installer -pkg DarwinPorts-1.2.pkg -target « / »
hdiutil detach /Volumes/DarwinPorts-1.2/

En clair…

  1. goes to your Desktop folder
  2. grabs DarwinPorts from the opendarwin site
  3. mounts the dmg
  4. goes to the newly mounted DarwinPorts volume
  5. installs the package, targeted to the root, as the root user
  6. ejects the mounted disc image.

you then can use Automator to do this…

code taken from this page

Apple Remote Desktop

Apple Remote Desktop : outil de prise de main à distance sur MacOs

  • Activation de l’accès ARD pour n’importe quel compte autorisé à se loguer sur cette machine (les utilisateurs locaux et réseau).

$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all

  • N’autoriser que les utilisateurs possédant des droits d’administration :

$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users admin -privs -all -restart -agent -menu

  • Désactivation de l’ ARD et son démarrage automatique :

$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop

NB : Apple Remote Desktop est accessible depuis windows (UltraVNC) ou Linux (Terminal Server Client) via le protocole VNC

Data recovery for MacOs

From Freshmeat.net :

« …Disk Drill data recovery software designed natively for Mac OS. It can easily recover deleted files from external or internal hard drives, memory cards, etc. It also protects data by introducing Recovery Vault to ensure guaranteed Mac data recovery from HFS/HFS+/FAT file systems. It handles Mac data recovery from any, even formatted or raw, media. It finds any data (if it wasn’t overwritten), and supports any file system by offering Deep & Quick Scan data recovery methods. If you don’t want someone to undelete what you deleted, but it is still protected by Recovery Vault, you can specify a Master Password to protect your configuration… »

A tester.

Enable root user in MacOS X

From HowToGeek :

How to Enable the Root User in Mac OS X

When you are using OS X, sometimes having only administrator access is not enough—when you need more access you will want to be the root user, which is similar to using the sudocommand in the Terminal, but for the whole OS.

Note: We’re showing you how to do this, but not necessarily recommending that you do it—it’s useful for certain scenarios, like getting total access to everything on your computer, but you shouldn’t use the root user as your normal user account.

Enabling the Root User

First you will need to open the System Preferences, then click on Accounts.

Next choose Login Options.

Then you will want to Edit the Network Account Settings, or choose Join if you see that button instead.

Now you want to Open Directory Utility.

Next you will want to open the Edit menu and select Enable Root User.

Now that you have enabled the root user, you will need to change the password. Again, choose the Edit menu, and then select Change Root Password…

Finally you will choose a password and verify it. Make sure its something you will remember otherwise you can just go though this process again.

At this point you can use the Log Out item on the system menu, and then login as the new root user.

SSH client for Windows Mobile 6.5

Looking for a good Windows Mobile SSH client for my phone…

  • PocketPutty is full of features and steps in on Windows Mobile to perform as the Windows Client has always been known to do… but it doesn’t work on my X800 🙁
  • ZaTunnel idem, doesn’t work on my X800 🙁
  • Token2Shell/Mobile a good one but not free 🙁

Comparaison des clients SSH

SSH Client for Itouch

Pas facile de trouver un client ssh gratuit pour Itouch / IPhone merci à /dev/null :

« … a truly free SSH client for the iphone or ipod touch: « The Rove Mobile Admin Client » aka « Mobile Admin »; search for it in the app store. Not too many features, but it’s the only free SSH client I’ve seen for the itouch…. »

Même soucis sous WM 6.5 🙁

Comparaison des clients SSH

« Page précédentePage suivante »