Saturday, November 23, 2013

How to Use X windows

0 comments

How to Use X windows


The X Window system, make the use of graphical components: X draws the screen, draws objects on the screen, and tracks user input actions such as keyboard input and mouse operations.

For more details :




     
Read more...

Wednesday, November 20, 2013

Linux : how to mount Usb flash drive from command line

0 comments

Linux : how to mount usb flash drive from command line

It's easy to mount a Usb flash drive in Linux from te bash by typing three Linux commands, I'm sure you will find others do it differently than me (using parameters).

Here, I will show you the simple method to do it (without using any parameters).

First, you need to know the device name (sdb*) after you plugged in the Usb flash drive by typing this command (It needs root permission)

sudo fdisk -l

The results will be :

sudo fdisk -l
sudo fdisk -l
The device name here is sdb1. sda1 sda2 ... are partitions of the hard drive.

Now, we need to create a Folder (we will use it later)

sudo mkdir /media/usb

We can mount it now in that folder we created

sudo mount /dev/sdb1 /media/usb

The content of the usb flash drive will be in this path /media/usb.
Before you reject it, you need to unmount it first by this command

sudo umount /dev/sdb1

In case, you want to mount it again, you don't need to create that folder again, because It is there.


     
Read more...

Basic Linux commands

0 comments

Basic Linux commands

Almost These Linux commands are basics except those which relate to package manager, we all know that they differs, Ubuntu, Mint ... use Apt, Arch uses Pacman ...

Here are some Basic Linux commands :

Display Linux distributor's ID
lsb_release -is

Display Linux release number
lsb_release -rs

Display Linux code name
lsb_release -cs

Display machine hardware name
uname -m

List all PCI devices, such as display card and ethernet card.
lspci

Reclaim memory which stores pagecache, dentries and inodes
echo 3 > /proc/sys/vm/drop_caches

Display a list of modules in the Linux Kernel
lsmod

List USB devices
lsusb -v

Display the status of ethernet card
sudo ethtool eth0

List hardware
sudo lshw

List harddisk partitions
sudo fdisk -l

Display SATA harddisk parameters
sudo hdparm -I /dev/sda

Display disk space usage
df -h

Display file/folder space usage
du -bsh FOLDER_NAME

Display amount of free and used memory
free

Display processes
ps -e

Display a tree of processes
pstree

Display processes dynamically
top

Terminate a process with a given process id
sudo kill -9 PROCESS_ID

Terminate all processes with a given name
sudo killall PROCESS_NAME


List files which are opened by a given process
lsof -p PROCESS_ID
lsof -c PROCESS_NAME

List processes which opened a given file
lsof FILE_NAME

List processes which are using port 80
lsof -i :80

Configure an ADSL connection
sudo pppoeconf

Starts up ADSL connections
sudo pon

Shuts down ADSL connections
sudo poff

Display MAC of a given IP address
arping IP_ADDRESS

Display NetBIOS name of a given IP address
nmblookup -A IP_ADDRESS

Display IP address and MAC
ifconfig -a

Display route
netstat -rn

Set MAC of ethernet interface
sudo ifconfig eth0 hw ether 00:11:22:33:44:55

Display information of a domain name
whois example.com

Display the network path to a given host
tracepath example.com

Request an IP address from DHCP server
sudo dhclient

Temporarily restart an init script
sudo /etc/init.d/SCRIPT_NAME restart
Temporarily stop an init script
sudo /etc/init.d/SCRIPT_NAME stop

Add a user
sudo adduser USER_NANE
Delete a user
sudo deluser USER_NAME

Change user password
sudo passwd USER_NAME

Changes user fullname, office number, office extension, and home phone number information.
sudo chfn USER_NAME

Display user information
finger USER_NAME

Temporarily prevent a user from logging in
sudo usermod -L USER_NAME

Revoke the operation above
sudo usermod -U USER_NAME

Add a user to admin group
sudo usermod -G admin -a USER_NAME

Set the HTTP proxy
export http_proxy=http://PROXY.DOMAIN.NAME:PORT

Modify the information displayed after logging in
sudo vim /etc/motd.tail

Choose the input method for X Window
im-switch -c

Convert the file name from GBK to UTF8
convmv -r -f gbk -t utf8 --notest FILE_NAME

Convert the file content from GBK to UTF8
iconv -f gbk -t utf8 FILE_NAME

Convert tags in '*.mp3' from GBK to UTF8
find . -name '*.mp3' -execdir mid3iconv -e GBK {} \;

Read a long file
less FILE_NAME

Print lines matching a pattern
grep REG_EXP FILE_NAME

Display a list of file name. The files contain a given string.
grep -lr REG_EXP PATHNAME

Display all '.txt' file
find . -name '*.txt'

Create two empty files
touch file_name_1 file_name_2

Create directory. Create parent directories as needed.
mkdir -p /tmp/a/b/c/d/e

Change working directory to the home folder
cd

Change working directory to the previous working directory
cd -

Display hidden files
ls -a

Copy directory. Preserve links, file mode, ownership, timestamps.
cp -a SOURCE_DIRECTORY DEST_DIRECTORY

Determine file type
file FILE_NAME

Output the last 6 lines
tail -n 6 FILE_NAME

Copy files via SSH
scp -rp FILE_NAME USERNAME@HOST:DEST_PATH

Rename '*.rm' files to '*.rmvb' files
rename 's/.rm$/.rmvb/' *

Change the file name to lowercase
rename 'tr/A-Z/a-z/' *


Display subdirectories in current directory
ls -d */.

Display file number in current directory
ls . | wc -w

Extract "*.gz" file
gunzip FILE_NAME.gz

Extract "*.tar.gz" file
tar zxf FILE_NAME.tar.gz

Extract "*.tar.bz2" file
tar jxf FILE_NAME.tar.bz2

Do compression
tar czf FILE_NAME.tar.gz FILE1 FILE2 FILE3
tar cjf FILE_NAME.tar.bz2 FILE1 FILE2 FILE3

Displays a calendar
cal
cal MONTH YEAR

Set the date and time via NTP
sudo ntpdate ntp.ubuntu.com

Poweroff your computer
sudo halt
sudo shutdown -h now

Poweroff your computer in 23:00
sudo shutdown -h 23:00

Poweroff your computer after 60 minutes
sudo shutdown -h +60

Reboot your computer
sudo reboot
sudo shutdown -r now

If you want some program to start up automatically, please put '.desktop' files into '$HOME/.config/autostart'

You can configure "preferred applications" by this file "$HOME/.local/share/applications/mimeapps.list"

Continuously monitor the memory usage
watch -d free

Display HTTP HEAD response
w3m -dump_head http://example.com

Display file content with line number
nl FILE_NAME

Eliminate Rootkit
sudo rkhunter --checkall

Change hostname
sudo hostname new_name

"Tasksel" group software packages into "task"s. You can select a "task" and then install all necessary software packages. It is easy to set up LAMP servers or cloud computing servers.

Show all tasks
tasksel --list

Display the extended description of a task
tasksel --task-desc lamp-server

List the packages which are parts of a task
tasksel --task-packages lamp-server

Install/remove a task
gksudo tasksel

Change Process priority
renice NEW_PRIORITY `pgrep NAME_OF_PROCESS`
example: renice 5  `pgrep firefox`  
         renice -5 `pgrep wine-server`    
               high <------------------> low
NEW_PRIORITY = -19, -18, -17 [...] 18, 19, 20

Clear Bash history
history -c

If you want to use colorful "ls", that is, use colors to distinguish types of files, you can add these lines in $HOME/.bashrc:

if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
fi

$HOME/.thumbnails/ directory is a cache dir GNOME makes when you browse through your folders in nautilus.
It contains thumbnail pictures of picture files you've previously looked at.

You can get its total size by
du -bs $HOME/.thumbnails/

You can delete the files in the .thumbnails directory that haven't been accessed for seven days, to free disk space.
find $HOME/.thumbnails/ -type f -atime +7 -exec rm {} \;

Capture screen after 10 seconds
gnome-screenshot -d 10
Capture current window after 10 seconds
gnome-screenshot -wd 10

Start GConf editor:
Press Alt+F2, type 'gconf-editor'.

Set apt source
sudo software-properties-gtk
sudo software-properties-kde

Display the packages which are not installed but have remained residual config
dpkg -l | awk '/^rc/ {print $2}'

Add a PPA repository:
sudo add-apt-repository ppa:PPA-REPOSITORY-NAME

Display a list of files. The files are installed from a given package.
dpkg -L PACKAGE_NAME

Display a list of packages. The packages installed a given file.
dpkg -S FILE_NAME

Display a list of packages. The name of packages matches given regex pattern.
apt-cache search REG_EXPRESSION

Display a list of packages. The packages provide a given file.
apt-file search FILE_NAME

Display a list of packages. The given package depends on the list of packages.
apt-cache depends PACKAGE_NAME

Display a list of packages. These packages depend on the given package.
apt-cache rdepends PACKAGE_NAME

Prompt for a disk to be inserted and then add the disc to the source list.
sudo apt-cdrom add

Install the newest versions of all packages currently installed on the system.
sudo apt-get upgrade

Delete residual package configuration files.
dpkg -l | grep ^rc | awk '{print $2}' | sudo xargs dpkg -P

Automatically install necessary files for './configure ; make ; make install'
sudo auto-apt run ./configure

Save the list of packages currently installed on your system.
dpkg --get-selections | grep -v deinstall > SOME_FILE
Then use the file to restore packages.
dpkg --set-selections < SOME_FILE ; sudo dselect

After running "sudo apt-get install", "*.deb" files are stored in "/var/cache/apt/archives"
You can clean this directory by:
sudo apt-get clean

Display URL for a given package
apt-get -qq --print-uris install PACKAGE_NAME

Display some statistics about the apt cache
apt-cache stats

Display all package name
apt-cache pkgnames

Display some information of a given package
apt-cache show PACKAGE_NAME

     
Read more...

Sunday, November 17, 2013

Valve announces SteamOS which is Linux-based, free and coming soon

0 comments

Valve announces SteamOS which is Linux-based, free and coming soon

Valve has announced a new operating system based on Linux called SteamOS. It is said to run on any living room hardware.

"As we’ve been working on bringing Steam to the living room, we’ve come to the conclusion that the
environment best suited to delivering value to customers is an operating system built around Steam itself.
SteamOS combines the rock-solid architecture of Linux with a gaming experience built for the big screen.
It will be available soon as a free stand-alone operating system for living room machines."

     
Read more...

Rekonq's new release

0 comments

Rekonq's new release

Rekonq's new release


Rekonq is a web browser for KDE based on webkit focusing on being “light” and “fast”

     
Read more...

Saturday, November 16, 2013

Try Windows 3.1 online

0 comments

Try Windows 3.1 online


We saw these days different websites that offers trying some Linux interfaces (Unity,Gnome shell …). This time we can try something different, what about Windows ?
Yes Windows, but the old one :D : Windows 3.1.
You can try it by clicking Here
The emulator is Created by Michael Vincent


     
Read more...

Linus Torvalds Admits He’s Been Asked To Insert Backdoor Into Linux

0 comments

Linus Torvalds Admits He’s Been Asked To Insert Backdoor Into Linux


Linus Torvalds was asked many questions at the conference in New Orleans with many Kernel developers. One question he was asked was whether a government agency had ever asked about inserting a back-door into Linux.
Torvalds responded ‘no’ while shaking his head ‘yes,’ as the audience broke into spontaneous laughter.Torvalds also admitted that while he as a full life outside of Linux he couldn’t imagine his life without it. ‘I don’t see any project coming along being more interesting to me than Linux,’ Torvalds said. ‘I couldn’t imagine filling the void in my life if I didn’t have Linux.’”





     
Read more...

Friday, November 15, 2013

Check your Linux installation if It is 64bit or 32bit

0 comments

Check your Linux installation if It is 64bit or 32bit

It’s very easy to know if you run 64bit or 32bit kernel

If you don’t have a computer which does not support 64bit (if you don’t know yet check here)your kernel will not be for 64bit for sure.
To find out if you are running 64bit or 32bit installation, just run this command :
uname -m
If the output is:
x86_64 Then you are running 64bit Linux Kernel.
And if the output is:
i686 That means you are running 32bit Linux Kernel.


     
Read more...

Find out if Processor / CPU is 64 bit or 32 bit

0 comments

 
Find out if Processor / CPU is 64 bit or 32 bit

How do I determine if my CPU is 64bit or 32bit under Linux operating systems ?

I’m sure there are many ways to do it, but I choose just two methods.
We will begin with the easiest one.

Method one:

A simple command gives you an output that if your Processor supports 64bit
This is the command:
lscpu | grep “CPU op-mode”
The output will be like that:
CPU op-mode(s): 32-bit, 64-bit
It means that my Cpu supports both 32bit 64bit.
Now we move to next Method.

Method two:

This is the command
grep flags /proc/cpuinfo
will give you an output like this
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
CPU Modes:
  • lm flag means Long mode cpu – 64 bit CPU
  • Rm flag means Real mode 16 bit CPU
  • Pm flag means Protected Mode is 32-bit CPU
In our case we have Lm which means we have supports for 64bit 
Enhanced by Zemanta


     
Read more...

Disable trusted platform module

0 comments

Disable trusted platform module
In the sense of freedom, “Trusted computing chips” are not a good way to go .
No matter what you heard about it (security bla bla), It’s a way to take your freedom away by  storing some keys.
Of course you are not the controller, so It takes your freedom away.
To disable them, here is two ways to do it :

Disable Tpm Modules :

First we need to check if there are Tpm modules by writing this command :
lsmod | grep tpm
If you found results then you can use this commands to delete each found module.
sudo rmmod tpm_results
tpm_results can be replaced by a tmp module found, the command can be repeated many times depending on the results.

Temporarily disable Modules :

After finding Tmp modules, we can just block them by writing their names in this file
/etc/modprobe.d/blacklist
You will need permission, and you can use any editor you like, for example, I’m using gedit :
sudo gedit /etc/modprobe.d/blacklist
Note :
most of these TPM “Security” Chips are found on Intel Motherboards.


     
Read more...

Kill Process in Linux

0 comments

Kill Process in Linux

Sometimes, an app hangout and you don’t know how to stop it.
Of course this problem is presented in all operating systems including Gnu Linux.
In this post I will show you methods to  Kill Process in Linux.

Method one :

This method depends on the Gui.
To kill Process in this method, we need to call an app tasks usually named  system monitor
system monitor
system monitor

Method two : 

This method depends on Linux commands or command line.

xkill

This command does not function in all distros,
When executing it, the shape of the mouse changes and you have to click the object you want to kill.
xkill
xkill

killall

We write just after it the name of the object we want to kill.
for example we we will kill Vlc by this command
killall vlc

pkill

pkill vlc

kill -9

Very functioning command, but it does not need the name of the object, it needs the Pid.
to get the Pid, you can run top command and see it from there.
example
kill -9 2585


     
Read more...

Thursday, November 14, 2013

Powerful linux terminal emulators

0 comments

Powerful linux terminal emulators

even though Linux Commands isn’t necessary to use in modern desktop Linux distributions, but it is still being used often, with Linux commands or text-based applications you can perform a specific tasks in short amount of time using a terminal, unlike with graphic apps.
Of course because of various tasks that can be performed by text-based applications there are lot of Linux terminal emulators to chose from . here is a list of the most popular and powerful Linux terminal emulators.

Terminator

Terminator
Terminator
Terminator is considered the best Linux terminal by many user including me. It has a lot of and nice features, it gives the ability to split into small parts inside the main window, drag and drop re-ordering of terminals…
This application is written in Python, and it will work on any other platform with Java.
It means Terminator can be used in Mac Os X, Windows as well, but a little slower .

Gnome terminal

Gnome terminal
Gnome terminal
It is very used and popular since it is Terminal emulator for the gnome desktop environment, and lot of distributions have it in their desktops such as Ubuntu, Mint, Ferdora …

LXterminal

LXterminal
LXterminal
LXterminal is fast, lightweight, flexible and able to run in all desktop environments.
It is based on Lxde, and compatible with other desktop environments that’s why we see it in many distributions such as Bodhi, ArchBang,Manjaro …

Guake and Yakuake

Yakuake
Yakuake
guake
guake
Guake is used in Gnome environment while Yakuake is used in Kde environment. both adopt the style of the Quake video game, these terminals show up and hide up when using quick keystroke (f12 by default).they are perfect for when you need a terminal quickly to just run a few Linux commands.

Tilda

Tilda
Tilda
Tilda has the similar style as Guake and Yakuake, it will slide down when you hit some hot key ( F1 by default) but you have more configuration options in Tilda than in Guake and Yakuake. With Tilda you can chose where to put it (position) and you can also edit the size of the terminal window and use some animation effects on Tilda, but, you can’t drag it around on the desktop screen like with other terminals.


     
Read more...

Try Gnome online

0 comments

Try Gnome online

Try Gnome online

After we saw Unity online provided by Ubuntu Website, here is another website : Symbiose which gives the opportunity to try gnome online for those who want to see the interface and know if they will like it or not.
Give it a try and see how it goes :


     
Read more...