26 Apr 2020 @ 2:51 PM 

TL;DR : cd ~/public_html/var/session/ && ls -1 | wc -l && perl -e 'for(<*>){((stat)[9]<(unlink))}' && ls -1 | wc -l with a close follower from rsync: rsync -a – delete /tmp/empty/ ~/public_html/var/session/ .

I had to delete ~1.700.000 files in a Magento ./var/session/ folder

  • the Plesk interface crashed after a few minutes because it didn’t have the memory to list the folder’s content
  • after ssh-ing into the machine, the classic rm -rf var/session/* also crashed afeter a few minutes with the error: ” -sh: /usr/bin/rm: Argument list too long”

Count the initial number of files:

cd ~/public_html/var/session/

ls | wc -l

So I started looking on other solutions on the wild web and I came to this Kinamo post: Efficiently delete a million files on Linux servers that had 4 variants:

  • `-sh-4.2$ rm -rf var/session/*` -> -sh: /usr/bin/rm: Argument list too long
  • `find /yourmagicmap/* -type f -mtime +3 -exec rm -f {} \;`
  • `find /yourmagicmap/* -type f -mtime +3 -delete`
  • `-sh-4.2$ rsync -a –delete /tmp/empty/ var/session/`

Details on those variants:

  • rm: deleting millions of file is a no-can-do!
  • find -exec: an option, but slower!
  • find -delete: fast and easy way to remove loads of files.
  • rsync –delete: without doubt the quickest!

Beside that post, I found another solution proposed on a Unix StackExchange thread: Faster way to delete large number of files [duplicate] which had answers on another one: Efficiently delete large directory containing thousands of files. The solution was a delete-in-5000-files-batches script:


# Path to folder with many files

# Temporary file to store file names

if [ -z "$FOLDER" ]; then
    echo "Prevented you from deleting everything! Correct your FOLDER variable!"
    exit 1

while true; do
    FILES=$(ls -f1 $FOLDER | wc -l)
    if [ "$FILES" -gt 10000 ]; then
        printf "[%s] %s files found. going on with removing\n" "$(date)" "$FILES"
        # Create new list of files
        ls -f1 $FOLDER | head -n 5002 | tail -n 5000 > "$FILE_FILENAMES"

        if [ -s $FILE_FILENAMES ]; then
            while read FILE; do
                rm "$FOLDER/$FILE"
                sleep 0.005
            done < "$FILE_FILENAMES"
        printf "[%s] script has finished, almost all files have been deleted" "$(date)"
    sleep 5

Stats for my test:

  • batch-delete-script: 5000 files / 43 seconds -> ~100 files/s
  • rsync: 50.000 files / 6 seconds -> 8300 files/s !!

Obviously, the rsync is the fastest solution for deleting a huge number of files!

PS. There was another solution on one of the stackexchange threads above, that claimed that a Perl one-liner would be even faster:

cd ~/public_html/var/session/ && ls -1 | wc -l && perl -e ‘for(<*>){((stat)[9]<(unlink))}' && ls -1 | wc -l

I tested it and it was really faster…

Posted By: Teodor Muraru
Last Edit: 29 Jan 2021 @ 01:50 PM

EmailPermalinkComments (0)
Categories: Linux, Technology
 13 Jan 2013 @ 2:46 PM 

I had a problem with viewing/editing a 370 Mb SQL file in Windows (7) on a machine with 4GB of RAM.

I searched some solutions:

Common candidates:

  • Notepad++, Notepad, Wordpad
  • SublimeText – my personal favorite (it surpassed Notepad++ in 2011 when I first read about it)
  • TextPad, UltraEdit, EditPlus (v3)
  • TheGun (“For 6k in file size, it is fully drag and drop enabled, it supports wordwrap and it has a separate accessory to change some of the startup settings. TheGun does not use any additional runtime DLLs and is coded in Microsoft Assembler (MASM) using the Windows API functions. TheGun does not have an effective file size limit and the maximum size that can be loaded into it is determined by available memory and loading speed of the file.”)
  •  Programmer’s File Editor
  • gVim (a port of vim for Windows), Cream (a wrapper/configuration editor over gVim)
  • some usual programming IDEs: PHPStorm – my personal favorite (it surpassed NetBeans in 2012), Netbeans, Eclipse – they all failed miserably ūüôā
  • Large Text File Viewer 5.2 (its last What’s new record was on 6/5/2009)
  • SlickEdit, 010 Editor, PilotEdit;
  • VEdit


  • Notepad++ (6MB kit/portable, open-source) – memory: 6MB at start, 785MB when editing, open in ~5 seconds, save in ~4 seconds, search in 6-11 seconds, instant edit/undo/redovery fluid when navigating inside the file (after an initial pause ~38 seconds); But, sometimes it won’t open it (Error: the file is too big)
  • SublimeText2 (6MB kit/portable, evaluation version – 30 days) – works, but VERY sluggish on all operations: open, find, save, undo; memory: 18MB at start, 2GB when editing,
  • Programmer’s File Editor (650K portable, open-source) – memory: 7MB at start, 420MB when editing, open/save in ~10 seconds, search in 2-3 seconds, instant edit/undo/redovery fluid when navigating inside the file; But: it said it cropped too long lines, which is kind of unacceptable (maybe there are settings to avoid it, but I tried the solution just as-it-was)
  • Large Text File Viewer 5.2 (500K portable, open-source) – memory: 1.5MB at start, 5MB when viewing, open in ~10 seconds, search > 150 seconds, NO edit/undo/redovery fluid when navigating inside the fileOnly viewer, no editor;  NO syntax highlighting;
  • TheGun (6K portable, open-source) – memory: 1.5MB at start, 792MB when viewing, open in ~20 seconds, save in ~10 seconds, search in 2-3 seconds, instant edit/undo/redo, very fluid when navigating inside the fileNO syntax highlighting;
  • Cream [gVim] (8MB kit, open-source) – memory: 4.5MB at start, 420MB when viewing, open in ~4 seconds, save in ~10 seconds, search in 2-3 seconds, instant edit/undo/redosluggish when moving inside the fileNO syntax highlighting;
  • TextPad (4MB kit, evaluation version – 30 days) – memory: 4MB at start, 22-26MB when editing, open in ~22 seconds, save in ~4 seconds, search in 1 second, instant edit/undo/redovery fluid when navigating inside the file; But it has a start warning about converting unknown characters to the system default code page 1252 (though it keeps its UTF-8 character set and saves it the same); NO syntax highlighting;
  • UltraEdit (33MB kit, trial version – 30 days) – memory: 19MB at start, 22-29MB when editing, open/save in ~10 seconds, search in ~5 seconds, instant edit/undo/redo, sluggish when moving inside the fileNO syntax highlighting;
  • EditPlus 3 (2MB kit, evaluation version – 30 days) –  won’t open it: “Out of memory”, Warning at opening: File is too large (recommends max file size: 323MB)
  • SlickEdit ( 78MB kit, trial version – 30 days) – memory: 54MB at start, 795MB when editing, open instantlysave in ~3 seconds, search in 1 second, instant edit, NO undo/redovery fluid when navigating inside the file (after a short initial pause ~3 seconds) ; NO syntax highlighting; When editing a file larger than 100MB, SlickEdit will turn off Undo/Redo capabilities for all files to improve performance.;
  • 010 Editor ( 13MB kit,evaluation version – 30 days) – memory: 9MB at start, 12-25MB when editing, open in ~4 seconds, save in ~4 seconds, search in 5 seconds, instant edit/undo/redovery fluid when navigating inside the fileNO syntax highlighting;
  • PilotEdit (10MB kit, trial version – 30 days) – memory: 12MB at start, 17-22MB when editing, open in ~32 secondssave in ~1 second, search in 5 seconds, instant edit/undo/redovery fluid when navigating inside the fileSyntax highlighting;
  • vEdit (2MB kit, trial version – 30 days) – memory: 3MB at start, 3MB when editingopen instantlysave in ~2 secondsearch in 2-3 seconds, instant edit/undo/redoconstantly (~2 seconds) waiting for disk operations when navigating inside the fileNO syntax highlighting; weird (old-ish) interface;

Testing conditions:

  • The search was made for some words at the end of the file, with the cursor positioned at the beginning
  • Syntax highlighting was needed for SQL
  • Navigation was tested using the mouse on the scrollbar, not the keyboard]
  • The test file was an SQL export (370MB)
  • I haven’t tried the suggestions on StackExchange – disable temporary file, syntax parsing and undo/redo functionality, though some of the programs offered to do some of these changes automatically for this kind of big files and eventually only for the current session – a thumb up for UltraEdit!

So, my winners are:

  • Free/Open-source: Notepad++, TheGun, Programmer’s File Editor, Cream [gVim], Large Text File Viewer
  • Trial/Evaluation: TextPad, PilotEdit, 010 Editor, vEdit, UltraEdit, SlickEdit
Posted By: Teodor Muraru
Last Edit: 31 May 2020 @ 09:51 PM

EmailPermalinkComments (0)
 14 Nov 2011 @ 8:46 PM 

Linux Mint 12 Preview

Linux Mint 12 Preview

As you can see it‚Äôs a mix of old and new. It‚Äôs a brand new desktop but with traditional components. We‚Äôre excited about the new technology but it‚Äôs important everyone feels at home. So a Mint desktop looks and behaves like a Mint desktop and this one feels both like Gnome 3 and the traditional Linux Mint desktops that preceded it. You can launch applications from the top left, easily switch between applications and workspaces using the window list or keyboard shortcuts, keep an eye on your notifications at the top and access Gnome 3 features like ‚Äúactivities‚ÄĚ from the top-left corner.

Posted By: Teodor Muraru
Last Edit: 14 Nov 2011 @ 08:46 PM

EmailPermalinkComments (0)
Tags: , ,
Categories: Linux
 05 Aug 2010 @ 2:25 PM 

The 5-Minute Essential Shell Tutorial @linuxmint.com

Alright, far too often (especially in the IRC channels) there is a time where even the most beginner of users are faced with the terminal.¬† It has many names: terminal, shell, console, “command prompt” even as a carryover from those familiar with Windows.¬† Many people are frightened by it for some reason or another, so this tutorial will attempt to provide you the most basic of commands to enable navigation and basic system actions from the comfort of your keyboard.

Let’s get started shall we?¬† Since everyone’s Mint version can be different, I’m not going to detail how to actually open the terminal.¬† I’ll assume you can find it in the menu or by right-clicking in the desktop.


  1. You can do almost anything in a terminal which you would also do from a GUI interface.
  2. Most commands were designed first to work in the terminal, then a GUI put on top of them.¬† That’s why some GUI’s may feel clunky – they were an afterthought at times.
  3. The default location for your terminal to open from the menu is in your home folder, also known as ~
  4. Your current directory can be noted by the . operator.  Most commands when they act on the current folder selection, operate on .
  5. Commands, locations, and files are case sensitive.  /home is not the same as /HOME or /Home.
  6. Use the tab key to complete file names.  If you have a long driver titled, for example,
    driver-128947232jaseu.sh, simply type dri¬†and it will fill in the rest, provided you don’t have 2 names starting with “dri” and if you do, add another character to make it “driv” and try again.
  7. Almost any command can be read about in full using the manpage or by typing -h or –help after writing the initial command.¬† This syntax is either¬†man command_name,¬†¬†command_name -h, or¬†command_name –help.
  8. To get even more information, you can use info.  A command can be searched for by using info command_name.  For most of these commands which are part of the coreutils package, one can find info as well using info coreutils command_name invocation where command_name is replaced by the command searched for.
  9. Almost any command can also explicitly display what is happening.¬† This is done usually by the¬†-v or¬†–verbose
  10. You can specify multiple command flags to a command at a time to get more information (see the ls -alexample below.)
  11. Command names are not always obtuse – due to space limitations in the old days of Unix they were shortened, and the conventions stuck.


cd -> Used to navigate the directories.  You can move to any location by path.

  1. cd This will move you back to your home, same as cd ~
  2. cd .. This will take you back exactly one directory.  Starting in /home/justin/Desktop, cd .. will put me into /home/justin.  This can be expanded upon, cd ../../ from the Desktop location instead will move me 2 back, from my Desktop to /home.
  3. cd foldername/ This will move you forward to the given folder in your current folder. Take note of the missing prefix / it is an important omission.  if I am in /home/justin and I want to get to Desktop, I must type cd Desktop/ without the / before Desktop.  Typing / before it places us in the root of file system, which is incorrect.
  4. cd /some/other/path This will take you to the specified folder path, supposing it exists as typed exactly.¬† Don’t forget your tab completion!

ls -> Used to list folder contents.  You can view many kinds of file and folder attributes.

  1. ls By itself, ls will simply list all your files in the current folder.  From fact #4, this literally does ls .
  2. ls -l Provides a longer listing format including owners, permissions, size, and date modified.
  3. ls -a Displays hidden files and folders as well as the normal listing.
  4. ls -al Combine options to display both hidden files and in the long format.
  5. ls -h Show file sizes in human readable format (K, M, Gbyte) filesizes instead of bytes.  Often used in conjuction with the -l flag.
  6. You can view files in directories you are not even in.  If I am in /home/justin/Desktop, and I want to view a file in /home/justin, I can do ls ../ list files one directory back (and not have to go back to do so.)

cp -> Copy files

  1. cp file /path/to/folder Copies specified file to the given path.
  2. cp -r folder /path/to/folder Copies recursively the contents of the folder to another folder.
  3. cp *.extension /path/to/folder Copies files matching the given extension to the new folder.  To copy all .doc files, it becomes cp *.doc /path/to/folder and the folder must exist.
  4. cp name* /path/to/folder Copies all files starting with ‘name’ to the given folder.¬† To copy all files starting with example, it becomes¬†cp example* /path/to/folder and the folder must exist.

mv -> Move files

  1. The syntax of mv is similar to the example above with cp exempt for example #2.  mv does not take the -r flag since moving a folder also moves its contents.  The syntax is not exact in all instances, but works with the above examples.  Consult your manpages for more details.

rm -> Remove files

  1. For all intents and purposes, removing files via¬†rm is permanent.¬† It does not use the Trash bin.¬† Use with caution and make sure you are deleting explicitly what you want, not what you think you want.¬† If you decide to get fancy with your delete commands, it’s probably going to come back to bite you.
  2. rm file Remove the specified file from the system.
  3. rm -r folder Remove the specified folder from the system
  4. rm -rf folder Removes the specified folder forcefully from the system.  This command can severely break your configuration if used incorrectly as it will not prompt you if something critical is being deleted.  If you have to use this, chances are something more is broken or there was a mistake made.  This should only be used as an absolute last resort method and is not recommended.

nano -> full command line text editor

  1. One can edit files using¬†nano in a terminal to do quick and dirty files all the way up to full configurations.¬† It’s handy, but keep in mind it handles plain text files and programming files, things like MS Word documents will not open properly!
  2. If a file is owned by root, it is not editable as a normal user.  nano must be prefixed with sudo in order to save changes.  Otherwise, it will open in read-only mode.
  3. nano newfile.whatever Nano creates a new file of the specified name and opens it for editing.
  4. nano existing_file Nano opens the existing file for editing.
  5. From inside nano
    1. Save file using the ctrl+o key combination, and either change the name or press entier to keep the same name.  This will save the file.
    2. Exit nano by using ctrl+x key combination.  If you have unsaved changes, it will ask if you want to save.

mkdir -> Create directories

  1. mkdir folder_name Creates the folder with the specified name
  2. mkdir -p /path/to/folder/name Creates each folder as necessary.  To create folder /home/justin/newfolder/2ndfolder, and only /home/justin exists, using mkdir -p will make both directories newfolder and 2ndfolder.

ps -> List processes

  1. ps aux List all processes in detail running on the system, including user, Process ID (PID), and name of process.  Using this, one can view their process list and if necessary, kill unnecessary or stalled processes.

kill / killall / xkill -> Kill offending processes.

  1. kill PID PID is a number referencing the offending process.  One should obtain the PID from a command likeps aux.  If a process refuses to die, one can alternatively specify kill -9 PID which should terminate the process by any means, even uncleanly or if it will mess up the system.
  2. killall program Killall kills *by name* all instances of said program.  If there are for example 3 firefox sessions open, killall firefox will do just that; kill all firefox sessions.  kill would simply take the specified PID of the offending firefox process you wish to kill, and kill that one only.
  3. xkill is a GUI way to click and kill windows.  Typing in xkill should present a skull-and-crossbones icon, and the next window clicked on will be killed.

Pipes ->  The most useful thing you will learn in *NIX.  Redirecting output of a program to anothers input.

  1. Pipes are represented by the ‘ straight bar ‘ otherwise known as the ‘ | ‘ key.
  2. It is a rarely used key in Windows, it is often found on the backslash key.
  3. They are used to link commands together.  Pipes take the output of one command and route it to be used as input for a second command chained together.
  4. Consult more online resources with information about pipes and their use as there are volumes.

> and >> redirectors¬† –> Send output to a file instead of the terminal.

  1. > is used to *overwrite* currently existing files contents and replace with the output from the new command.
  2. >> is used to *append* information to currently existing files.  This is useful for logging.
  3. Example: ps aux > processes.log Sends the output of ps aux to the file processes.log for viewing the command output in a text editor and overwrites the current contents of the file.

tee -> Send output to both a file and the terminal

  1. tee is used in conjunction with a ‘ | ‘ in order to take the command output and send it elsewhere.¬† This is useful if there are errors which fly by the screen before you can read them, this way whatever goes on the screen is also captured to a file.
  2. Example:¬†dmesg | tee boot.txt would run the command¬†dmesg which shows the initial boot info, and the ‘¬†| ‘ sends the output of¬†dmesg to¬†tee, which then does its job by sending it to the terminal and to the log file¬†boot.txt.

File Execution

So you want to execute files or programs from the terminal?¬† Make sure it’s¬† marked executable.¬† If not, see Quick Tip #4 below.

  1. Need to execute a file in the current directory after it is marked executable?¬† The ./ operator can execute the file as a normal user provided you do not need root rights.¬†¬†./ literally means “in the current directory” so it does not work on files outside of the present directory.
  2. Need to execute a file¬†not in the current directory?¬† You must pass the path to the proper executing program.¬† If it is a python program, it’s¬†python /path/to/file and if it is a shell file, it is¬†sh /path/to/file as an example.¬† There are of course other programs, but these will be the most common for beginners.
  3. Need to execute a file with root rights because you received operation not permitted?  Prefix the command with sudo.  Thus, from the above example, sudo python /path/to/file will execute the script with root rights.
  4. Need to execute a GUI program from the terminal?  Simply type the program name (case sensitive!) and it will launch.  This will render the current terminal unusable.  Closing the terminal while the program is open will kill the program.  A better way is to background the program, using program_name & and then typing the word exitat the terminal to close it and keep the process running.
  5. Need to run a GUI program with root rights from the terminal?  Prefix it with gksudo or gksu and not sudo.  Using sudo to launch GUI applications is a bad habit and should be avoided.
  6. Do not, do *not* use sudo simply because something receives “Operation not permitted.” Keep in mind what you are doing as you can absolutely *destroy* systems by running commands in the wrong place with root rights.¬† This point cannot be emphasized enough. Make sure your files come from reputable sources.

Quick tips:

  1. Lost yourself in a directory?  Not sure where you are?  Type pwd to print working directory.
  2. Want to calculate your disk space quickly?  df -h can give you a quick checkup.
  3. Want to calculate the size of a folder or file quickly?  du -cksh target_name can do exactly that.  Want to calculate the size of the current folder?  du -cksh .
  4. Need to mark a file executable?  chmod +x filename can do that.  Next time you see a file you need to execute and it is not marked executable, now you know how to fix it.
  5. Want to mount an iso like Daemon-Tools on Windows?  Linux has this functionality built in.  Simply create a directory somewhere, say /home/justin/isomount, and issue the command mount -o loop /path/to/myisofile.iso /home/justin/isomount and the contents will be mounted inside that folder.
  6. Run a command before, you need to re-run it, but you can’t really remember what it was exactly?¬† Type¬†historyinto the terminal and it will print out your command history.¬† Want to clear your history?¬†¬†history -c will wipe the information.
Enhanced by Zemanta
Posted By: Teodor Muraru
Last Edit: 05 Aug 2010 @ 02:28 PM

EmailPermalinkComments (0)
 29 Mar 2010 @ 11:04 AM 

Usability settings:

  • move window-bar action buttons from left (Ubuntu 10.10/Mac) to right:
    gconftool-2 – type string – set /apps/metacity/general/button_layout "menu:minimize,maximize,close"
  • remove confirmation for logout:¬†System Settings ->¬†Advanced ->¬†Session Manager ->¬†Confirm Logout
  • remove screen-lock after screensaver:¬†Control Center ->¬†Screensaver ->¬†Lock screen when screensaver is active (uncheck)

Processes management:

  • move a process to background (suspend):
  • list background/suspended processes:
    jobs (returns a list of ids of the stopped processes and their description: [1]+  Stopped  mc)
  • bring process to foreground:
    fg 1 (where 1 is the id of the desired process to resurrect from the above list)

Computer info:


  • # lists your hardware
    $ sudo lshw
  • # lists all hard disk
    $ sudo lshw -C disk
  • # xports an html page with hardware details
    $ sudo lshw -html > your-file-name.html

Sensors monitoring:

  • sudo apt-get install lm-sensors sensors-applet  #(ksensors for Kubuntu)
  • sudo sensors-detect

To see if your running kernel is 32-bit or 64-bit, just issue the following command:

  • $ uname -m
    x86_64 indicates a running 64-bit kernel. If you use see i386, i486, i586 or i686, you're running a 32-bit kernel. Note: x86_64 is synonymous with amd64.

How to find out the Ubuntu / Kubuntu version:

  • Debian:
     cat /etc/debian_version
  • Ubuntu / Kubuntu:
    • cat /etc/issue
    • lsb-release -a (sau  cat¬†/etc/lsb-release)

Change default browser:

  •  update-alternatives – config x-www-browser or  update-alternatives – config www-browser 

Display (only) symbolic links with details

  •  sudo find / -type l -print | xargs ls -lh

Display files/folder space usage

  • ¬†GUI:¬†
    • FileLight, Disk Space Analyzer or¬†gdmap¬†¬†(Gnome)¬†
    • ¬†KDiskFree or KDirStat¬†(KDE)
  •   CLI:
    • ncdu – interactive tool
    • df -h
    • du -bsh {FOLDER_NAME}
    • du –max-depth=1 * | sort -n
    • Find the top 10 biggest files:¬†find . -type f -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}¬†

Manage iso images and CD/DVD’s:

Create ISO imags from CD/DVD:

$ dd if=/dev/dvd of=dvd.iso # for dvd
$ dd if=/dev/cdrom of=cd.iso # for cdrom
$ dd if=/dev/scd0 of=cd.iso # if cdrom is scsi

These commands are useful for data CD/DVD images. For Audio CD’s there’s another (longer) story.¬†(A simpler way would be to use specialized apps like: K3b, Acetoneiso, Brasero)

Create ISO image from folders:

$ mkisofs -v -o /tmp/user-folder.iso -R /home/user/user-folder

Write ISO images to CD/DVD:

  • Find out your CDR/W SCSI address/device name:
    $ cdrecord -scanbus
  • Write ISO image:
    $ cdrecord -v -dao dev=1,0,0 speed=8 file.iso
    (Where, -speed=XX : Specify writing speed, -v : Verbose output, -dev : The virtual SCSI ID of the writing device [discovered with the earlier command])

Mount / Umount / Format

  •  sudo mount /dev/sdb1 /media/USB -t vfat  (sau ntfs / ext2/3/4) - montare partitie
  •  sudo umount /dev/sdb1  - demontare partitie
  •  sudo mkfs -t vfat /dev/sdb1  - formatare partitie
  •  sudo eject /dev/sdb1 

Install software packages:

Subiectul este destul de bine detaliat aici. Pe scurt:

  • .tar.gz / .tar.bz2:
    • extract sources:
      •  tar xzvf tarballname.tar.gz 
      •  tar xjvf tarballname.tar.bz2 
    • configure:
      •  cd tarballname 
      •  ./configure 
    • compile sources:
      •  make  [all]
      •  sudo checkinstall  [care inlocuieste:  sudo make install ]
  • .deb:
    • graphic mode: double-click the file
    • console:
       sudo dpkg -i file.deb 
  • .rpm:
    • conversion in .deb:
       sudo alien -k file.rpm  (after  sudo apt-get install alien , if not already installed)
    • install:
       sudo dpkg -i file.deb 

Calculate md5 checksums:

  • for a string:
      echo -n "aaaaaa" | md5sum 
  • for a file:
      md5sum file 

For Loop in Bash:

  • The simple bash loop to do something with all files in the directory is:
     for f in * ; do echo $f ; done

    which just displays all files in this case.

    This is easy, what I usually need and often forget how to do it is to execute some action exact number of times. Something like simple for loop in C or Java. And there is an exact match for such loop in Bash too:

     for (( i=1 ; i

    I found another similar solution on the Internet today at spiralbound.net:

     for i in $(seq 1 100); do echo $i ; done


  • UPPERCASE ‚Üí lowercase
      rename ‚Äėy/A-Z/a-z/‚Äô * 

Empty existing files / Create new (temporary) files:

  •  echo "" > file 
  •  cp /dev/null file 
  •  dd if=/dev/zero of=output.file bs=1 count=1 
  •  cat /dev/null > your_file 
  •  >filename
  •  touch /tmp/newfilename
  • command: mktemp which outputs something like: /tmp/tmp.yTfJX35144 script example:
      #!/bin/bash OUT=$(mktemp /tmp/output.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; }  echo "Today is $(date)" >> $OUT 

Source: here and here.

Switch from openjdk to sunjdk

OpenJDK is included in a number or popular Linux distributions. The procedure below explains how to switch to Oracle (Sun) JDK 1.6 in Ubuntu.
  • Enable the Canonical Partner Software through the following steps:
    Go to Ubuntu Software Center.
    Click Edit.
    Click Software Sources.
    Switch to the Other Software tab and check Canonical Partners. This may take some time.
  • In the Commandprompt, type the following sequence of commands:
    sudo apt-get update
    sudo apt-get install sun-java6-jre sun-java6-plugin
    sudo update-alternatives – config java


Posted By: Teodor Muraru
Last Edit: 05 Nov 2012 @ 09:57 AM

EmailPermalinkComments (0)
Categories: Ghid instalare, Linux, Useful
 05 Mar 2010 @ 2:15 PM 

RadioTray not playing some http urls

open ~/.gstreamer-0.10
remove or rename the registry.x86_64.bin
Open your music player.
It’ll regenerate the registry file and correctly use the aac plugin.

Source: here

Reparare sistem de fisiere ext4:

sudo fsck.ext4 /dev/sda3 [-p|-a]  sau

e2fsck -f -v -y /dev/sda3 [aceasta comanda e utilizata de gparted, la aplicarea optiunii “Check”]¬†(alte informatii aici si¬†aici)

Firefox intra in modul “Work offline” la fiecare pornire


Se foloseste alt manager de retea (wicd, in cazul meu), iar firefox-ul interogheaza doar network-manager, nu si wicd, care il inlocuieste, si nu stie ca computerul este conectat la net (fie cu un modem USB, fie wireless / cablu / PPPoE).


se tasteaza¬†‘about:config‘ in address bar (se accepta indicatia firefox-ului de a nu ‘strica’ nimic), se cauta optiunea¬†¬†‘toolkit.networkmanager.disable‘ (se poate folosi campul de filtrare) si se seteaza pe true. (kudos: openbala.com)

Dupa update de kernel, Kubuntu nu mai vede placile de retea (wired/wireless)


  • update-ul (automat al) kernel-ului.


  • /sbin/ifconfig -a
  • sudo dhclient3 eth0 (wlan0)


  • instalare wicd: sudo apt-get install wicd

Pango-WARNING **: shaping failure, expect ugly output.

I had the same problem with firefox 3.6.3 (not that the version matters…).


Este o eroare provenita de la fonturi instalate incorect sau cu drepturi de acces nepotrivite.


I tried some simple things:

  • I ran firefox as normal user (firefox in the console) -> it happened as described in this forum (no text, and the console was full of errors like: “Pango-WARNING **: shaping failure, expect ugly output. shape-engine=’BasicEngineFc’“).
  • I ran firefox as root (sudo firefox from the console) -> everything was OK (the console was clean).

So, the most simple solution was to delete all the fonts (as root):
cd /usr/share/fonts/truetype/msttcorefonts
rm -rf *
and reinstall them (as normal user):
sudo apt-get install msttcorefonts
here i ran into another smaller problem with a ttf font installer, so I had to do:
sudo apt-get remove ttf-mscorefonts-installer
sudo apt-get install msttcorefonts

Starting KTTSD failed

Este o eroare provenita de la lipsa pachetului KTTSD (text-to-speech).


pachetul kttsd nu e instalat si apoi:
1. exista o instalare anterioara de KDE (sau un backup/restore) care lasa in urma directorul .kde ce contine setari care implica acest feature
2. ceasul analog/digital este setat sa spuna ora prin text-to-speech


1. cea mai simpla: instalati  pachetul KTTSD  si dependintele sale, cu un total de ~ 24 MB Рdaca nu aveti limita/penurie de spatiu;
2. cautati si stergeti directorul .kde din home de la o fosta instalare KDE care instalase pachete din gama Accesibility, sau dezactivati folosirea feature-ului text-to-speech din programele/utilitarele care ruleaza – mai multe detalii aici si aici.

Redenumire fisiere din majuscule in ‘minuscule’


Am incercat sa uploadez pe photobucket.com niste poze preluate de pe camera mea , iar uploader-ul lor nu vedea decat fisierele cu extensiile scrise cu litere mici (minuscule?!), asa ca a trebuit sa le modific..


In Dolphin (managerul de fisiere default din Kubuntu) nu se pot modifica numele de fisiere bulk, si nu aveam chef sa fac iar comparatii intre file-managere, asa ca am trecut in clasica linie de comanda si am rezolvat usor (bine, dupa 5 minute de incercari si la sfarsit apeland la man [rtfm!]):

rename ‘y/A-Z/a-z/’ *

Samba suport in Kubuntu / Ubuntu 9.10

Basic Samba Setup in Ubuntu 9.10

Ubuntu 9.10 Karmic Koala has come out, and that means it’s time to explain how to do a basic Samba setup on the new version. All Terminal commands in this walkthrough are bolded, and USERNAME stands for your username on your Ubuntu system.

First, you’ll need to install Samba. Fire up a Terminal window and use this command:
sudo apt-get install samba
Follow the default prompts to install Samba. Now, Samba uses a separate set of passwords than the standard Linux system accounts (stored in /etc/samba/smbpasswd), so you’ll need to create a Samba password for yourself with this command:
sudo smbpasswd -a USERNAME
(USERNAME, of course, is your actual username.)
Type a suitably strong password (make sure it includes uppercase, lowercase, punctuation, and numbers). Once your password is created, the next step is to edit your¬†/etc/samba/smb.conf file, the configuration file for Samba. Begin by creating a folder named ‚Äėtest‚Äô on your home folder; we‚Äôll use that for our test shared folder (you can create other shared folders using the same method):
mkdir /home/USERNAME/test
Next, make a safe backup copy of the original smb.conf file to your home folder, in case you make an error:
sudo cp /etc/samba/smb.conf ~
Now use your text editor of choice to edit smb.conf:
sudo gedit /etc/samba/smb.conf
(New users will probably find gedit the easiest to use due to its GUI; but you can use emacs or vi just as readily, especially if you’re using the server version of Ubuntu, which doesn’t include X11 by default.)
Once smb.conf has loaded, add this to the very end of the file:
path = /home/USERNAME/test
available = yes
valid users = USERNAME
read only = no
browsable = yes
public = yes
writable = yes

(There should be no spaces between the lines, and note also that there should be a single space both before and after each of the equal signs.)
These settings will share the test folder we created earlier, and give your username and your username alone permission to read and write to the folder. Once you have input the changes, save smb.conf, exit the text editor, and restart Samba with this command:
sudo /etc/init.d/samba restart
Once Samba has restarted, use this command to check that your smb.conf doesn’t contain any syntax errors:
sudo testparm
If you pass the testparm command, Samba should be working; try accessing the shared folder from another computer on your LAN.

Posted By: Teodor Muraru
Last Edit: 10 Dec 2011 @ 04:09 PM

EmailPermalinkComments (0)
 13 Jan 2010 @ 12:03 AM 
run, 404, run!


copyleft hol.ro, by alecs at altlinux.org

Posted By: Teodor Muraru
Last Edit: 13 Jan 2010 @ 12:04 AM

EmailPermalinkComments (0)
Tags: , ,
Categories: Fun, Linux
 11 Jan 2010 @ 2:07 PM 

Postari relationate:

Aplicatii utile:

consola: konsole (pt KDEKubuntu) sau terminal (pt Gnome-Ubuntu) sudo apt-get install terminator (o consola ‘evoluata’ – [l]userii stiu de ce!)

vim (text editor),¬†wicd (network manager – interactiv install),¬†mc (file manager [text-mode]) or¬†krusader sau gnome-commander (file-managers [graphic mode]),¬†sun-java6-jre sun-java6-plugin sun-java6-fonts sun-java6-jdk (java – for netbeans++ – interactiv install),¬†sshfs (mounts ssh locations as folders),¬†cvs, hg (version control system),¬†htop (process viewer),¬†ailurus (ubuntu apps tweaker),¬†synaptic (apps manager –¬†graphical interface)

  • sudo apt-get install vim mc terminator sshfs htop ailurus hg¬†rar unrar arj p7xip-full xarchiver pidgin thunderbird tomboy¬†xvnc4viewer wine filezilla ffmpeg mencoder alien
  • sudo apt-get install wicd¬†sun-java6-jre sun-java6-plugin sun-java6-fonts sun-java6-jdk

More »

Posted By: Teodor Muraru
Last Edit: 14 Feb 2012 @ 06:24 PM

EmailPermalinkComments (0)

 Last 50 Posts
Change Theme...
  • Users » 1
  • Posts/Pages » 84
  • Comments » 8
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Filme vazute

    No Child Pages.

Carti citite

    No Child Pages.


    No Child Pages.