RSS

Linux

Trick parse option in bash shell

Vấn đề khó khăn khi lập trình trên bash shell là việc truyền các option vào bash shell. Tuy nhiên với thủ thuật nhỏ bash shell của các bạn sẽ trở thành pro hơn :

heocon@heocon-laptop:~$ cat --help
    Usage: cat [OPTION]... [FILE]...
    Concatenate FILE(s), or standard input, to standard output.
    -A, --show-all           equivalent to -vET
    -b, --number-nonblank    number nonempty output lines
    -e                       equivalent to -vE
    -E, --show-ends          display $ at end of each line
    -n, --number             number all output lines
    -s, --squeeze-blank      suppress repeated empty output lines
    -t                       equivalent to -vT
    -T, --show-tabs          display TAB characters as ^I
    -u                       (ignored)
    -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
    --help     display this help and exit
    --version  output version information and exit
    With no FILE, or when FILE is -, read standard input.
    Examples:
    cat f - g  Output f's contents, then standard input, then g's contents.
    cat        Copy standard input to standard output.
    Report cat bugs to bug-coreutils@gnu.org
    GNU coreutils home page:
    General help using GNU software: <http://www.gnu.org/gethelp/>
    Report cat translation bugs to <http://translationproject.org/team/>

Code : http://www.mediafire.com/download.php?3f46a0prk3eikvc (more…)

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
08 August 2010 | Linux,Tips & Tricks | | 0 Comments   

Khắc phục lỗi VGA Intel trên Ubuntu 9.04

Hôm nay lang thang bên ubuntuforum nhặt được cái TUT hay quá, teleport nó về cho anh em tham khảo! (dịch thì được nhưng thuật ngữ chuyên ngành thì mình tịt nên có gi anh em góp ý mình edit)
Tổng quan:
có một số vấn đề về CGA Intel trên 9.04
1. Driver hiện thời trong repo đang có một số vân đề về trình diễn với phương thức tăng tốc EXA, đa số người dùng thấy sự thể hiện 2D rất kém do thiết lập măc định của EXA là ” migration heuristic”. nếu chuyển thiêp lập này thành ” greedy” sẽ làm cải thiện được vấn đề.
2. Phương thức tăng tốc mới và nhanh hơn( UXA) không được đặt làm mặc định do có nhiều thông báolỗi của nhiều ngừoi dùng. Mã này đang được tích cực phát triển, đã đạt nhiều ổn định và hiệu quả hoạt động, các vấn đề đã được giải quyết trong các trình điều khiển mới nhất (cụ thể là trong các trình điều khiển intel, libdrm, mesa và nhân kernel mới nhất 2.6.29.3). Thật không may, Jaunty sẽ không bao gồm các phiên bản mới nhất cần thiết để cải thiện hiệu suất.
3. khả năng xử lí 3D đã giảm đi so với bản 8.10 do các thay đổi về code chính liên quan đên sự ứng dụng vào các code tăng tốc và quản lí bộ nhớ của 9.04. Chính những sự thay dổi này gây ra sự giảm đi trong tác vụ xử lí 3D
4. cả Xorg và driver của intel đều gặp một lỗi do sự phân bố không chính xác bộ nhớ xử lí đồ họa trong bộ nhớ đệm, kết quả là làm giảm suits rất nhiều khả năng xử lí 3D của chip Intel! (more…)

VN:F [1.9.3_1094]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
12 October 2009 | Linux | | 0 Comments   

Install Opera

To install and configure opera (since it’s useful for testing web pages to be able to check behaviour, and it’s useful to have another browser around sometimes), do the following:

sudo gpedit /etc/apt/sources.list

or

sudo nano /etc/apt/sources.list

… and add these two lines:

# For latest stable opera:

deb http://deb.opera.com/opera/ stable non-free

* Then do:

sudo wget -O – http://deb.opera.com/archive.key | sudo apt-key add -

sudo aptitude update

sudo aptitude install opera

* Then run opera – Applications -> Internet -> Opera

* Right-click on the tab bar, select Customise -> Toolbars tab -> change the “wrapping” setting to “Wrap to multiple lines”.

VN:F [1.9.3_1094]
Rating: 6.5/10 (2 votes cast)
VN:F [1.9.3_1094]
Rating: +1 (from 1 vote)
23 September 2009 | Linux | | 0 Comments   

Install the Tahoma fonts

Once the msttcorefonts package is installed you will notice that Tahoma and Tahoma Bold is missing. You will need to extract Tahoma and Tahoma Bold from the zip file. Tahoma is used for Microsoft desktop, title bars and menu fonts so if you are trying to get that XP look you will need the Tahoma regular and Tahoma Bold fonts. Install Tahoma by doing the following in a terminal.

cd ~
wget http://www.stchman.com/tools/MS_fonts/tahoma.zip
sudo unzip -d /usr/share/fonts/truetype/msttcorefonts ~/tahoma.zip
sudo fc-cache -f -v
rm -f ~/tahoma.zip
VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
23 September 2009 | Linux | | 0 Comments   

How to Find files on your computer with find ?

A standard Linux system has an incredible amount of files installed. Looking for a file location can be a painful task to do though a file browser.

Fortunately, there is a nifty command line available by default on any Linux distribution: find.

find can virtually find anything on your computer and comes with a lot of options. This tutorial will introduce a basic use of it and show how you can search your filesystem for file names matching a name pattern.

On Debian based distros, find is part of the package findutils. find allow one to search for files on a filesystem based on different condition, creation date, modified date, file size, file type, permissions, name ….

In this tutorial, I will be focused on finding files/directories based on their name, in order to explain in more depth the syntax of find, I will also show how you can narrow down your search by adding condition on size and file modification time.

This will suit most searches, if you need more details, I would recommend looking at the find’s manpage. (more…)

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
12 September 2009 | Linux | , | 2 Comments   

Ubuntu Intel Graphics Drivers (GM965/GM960 – X3100)

Sau một ngày vật vã với cái driver GM965 (X3100) của Intel trong ubuntu thì mình cũng đã cài đặt xong, sẵn đây viết lại vài dòng cho những ai đang gặp khó khăn giống mình. Driver Intel có sẵn trong Ubuntu 9.04 thật sự chưa đạt hiệu quả cho lắm, với lại đó là version cũ, support OpenGL không được tốt, nếu ai đã cài Cairo-Dock thì sẽ cảm  nhận được ngay. Sau khi nâng cấp driver xong, Cairo-Dock hoạt động rất là mượt.

Cairo-Dock

Sau khi check bằng ./compiz-check thì rất hài lòng, support OpenGL rất tốt : (more…)

VN:F [1.9.3_1094]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.3_1094]
Rating: +1 (from 1 vote)

How to make a Backtrack 4 Hard Drive Installation

Backtrack 4 does not contain any installer yet thus we wrote this step by step guide based on muts cookbook on how to install Backtrack 4 on our hard disk drive.

Step 1 – Creating the partitions

First we will need to create three partitions to be able to install backtrack on our hard disk drive. We will need boot, swap and root partitions to be created. (We can still create 2 partitions and install the boot inside the root partition)

fdisk /dev/sda

Creating the partitions

After we create the three partitions we need to change the type of partition 2 to swap and activate the boot partition, then write the changes (more…)

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

BackTrack 4 Pre Final Kernel Update

snapshot10

We have pushed a new kernel to the repository and updated several drivers. The upgrade process is a bit convoluted, but has been streamlined for the future. For now, run these commands from your backtrack box to update to the latest kernel and drivers:

apt-get update
apt-get install -d linux-image
cd /var/cache/apt/archives/
dpkg -i –force all linux-image-2.6.30.5_2.6.30.5-10.00.Custom_i386.deb
apt-get dist-upgrade
apt-get install madwifi-drivers
apt-get install r8187-drivers

After a reboot, you might want to run:

fix-splash

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
31 August 2009 | Linux | , | 0 Comments   

SSH Tunnel through HTTP proxy

You are behind an HTTP proxy that doesn’t allow you to access certain sites and you want to access them anyway’s.

This is your current situation:

before

You can accomplish this through a SSH tunnel. After I explain how to do it you will be in this situation:

after

What you’ll need is: (more…)

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
17 August 2009 | Linux | , , | 0 Comments   

Apache-PHP-MySQL trên Ubuntu

1. Cài đặt Apache2
Để cài đặt Apache2, hãy vào Applications -> Accessories -> Terminal và gõ lệnh sau:

sudo apt-get install apache2
Bạn cũng có thể dùng lệnh aptitude thay cho apt-get như sau:

sudo aptitude install apache2
Sau đó Ubuntu sẽ hỏi mật khẩu của bạn, sau khi nhập xong, quá trình download và cài đặt bắt đầu, bạn chỉ phải đợi 1 chút. (more…)

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
10 August 2009 | Linux | | 0 Comments   
Page 1 of 3123»