Showing posts with label linux terminal. Show all posts
Showing posts with label linux terminal. Show all posts

Friday, January 10, 2014

So you forgot your Ubuntu password ???

If you're unlucky enough not to remember your Ubuntu password, re-installing the OS is not the only option you've got :-) Follow the instruction in following link in Ubuntu Recovery to reset your password :-)

http://www.howtogeek.com/howto/linux/reset-your-forgotten-ubuntu-password-in-2-minutes-or-less/

Monday, January 03, 2011

Wednesday, December 29, 2010

Start X from shell, Ubuntu

First method, Use init script
sudo /etc/init.d/gdm start
sudo /etc/init.d/kdm start

Second method, type startx command :
startx

If nothing works, type xinit to star X server without KDE:
xinit

Now start kde with following :
startkde

Tuesday, December 28, 2010

add a user to Ubuntu from Shell/terminal

useradd -m -s /bin/bash userName
passwd userName
cd /home
ls -l
mkdir scheiber ----> if it already does not exist
chmod 0700 scheiber
chown -R scheiber:scheiber scheiber

Tuesday, December 14, 2010

List of people available in one IRC chat channel

  • List of people available in one IRC chat channel
    /who
  • Gives the real name of the given nickname/username
    /who nickname

Monday, October 18, 2010

Show Line numbers in VIM

To show line numbers in vim while editing document, run the following command :

Press Esc and write

:set number

Wednesday, April 07, 2010

How to open Gnome terminal in full screen mode


If you are wondering how to have your Gnome terminal opened in full screen mode as default follow these steps.

Make a shortcut on your top panel.
Right click on the Terminal icon up there and click properties.
Then in the command box instead of just "gnome-terminal" type the following :
gnome-terminal --full-screen

Saturday, November 14, 2009

Giving your screen session a name

You can use screen -S name or (inside running session) - Ctrl+A :sessionname name

Wednesday, November 11, 2009

Vim/Vi command sheet

Cursor movement

  • h - move left
  • j - move down
  • k - move up
  • l - move right
  • w - jump by start of words (punctuation considered words)
  • W - jump by words (spaces separate words)
  • e - jump to end of words (punctuation considered words)
  • E - jump to end of words (no punctuation)
  • b - jump backward by words (punctuation considered words)
  • B - jump backward by words (no punctuation)
  • 0 - (zero) start of line
  • ^ - first non-blank character of line
  • $ - end of line
  • G - Go To command (prefix with number - 5G goes to line 5)

Note: Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.

Insert Mode - Inserting/Appending text

  • i - start insert mode at cursor
  • I - insert at the beginning of the line
  • a - append after the cursor
  • A - append at the end of the line
  • o - open (append) blank line below current line (no need to press return)
  • O - open blank line above current line
  • ea - append at end of word
  • Esc - exit insert mode

Editing

  • r - replace a single character (does not use insert mode)
  • J - join line below to the current one
  • cc - change (replace) an entire line
  • cw - change (replace) to the end of word
  • c$ - change (replace) to the end of line
  • s - delete character at cursor and subsitute text
  • S - delete line at cursor and substitute text (same as cc)
  • xp - transpose two letters (delete and paste, technically)
  • u - undo
  • . - repeat last command

Marking text (visual mode)

  • v - start visual mode, mark lines, then do command (such as y-yank)
  • V - start Linewise visual mode
  • o - move to other end of marked area
  • Ctrl+v - start visual block mode
  • O - move to Other corner of block
  • aw - mark a word
  • ab - a () block (with braces)
  • aB - a {} block (with brackets)
  • ib - inner () block
  • iB - inner {} block
  • Esc - exit visual mode

Visual commands

  • > - shift right
  • < - shift left
  • y - yank (copy) marked text
  • d - delete marked text
  • ~ - switch case

Cut and Paste

  • yy - yank (copy) a line
  • 2yy - yank 2 lines
  • yw - yank word
  • y$ - yank to end of line
  • p - put (paste) the clipboard after cursor
  • P - put (paste) before cursor
  • dd - delete (cut) a line
  • dw - delete (cut) the current word
  • x - delete (cut) current character

Exiting

  • :w - write (save) the file, but don't exit
  • :wq - write (save) and quit
  • :q - quit (fails if anything has changed)
  • :q! - quit and throw away changes

Search/Replace

  • /pattern - search for pattern
  • ?pattern - search backward for pattern
  • n - repeat search in same direction
  • N - repeat search in opposite direction
  • :%s/old/new/g - replace all old with new throughout file
  • :%s/old/new/gc - replace all old with new throughout file with confirmations

Working with multiple files

  • :e filename - Edit a file in a new buffer
  • :bnext (or :bn) - go to next buffer
  • :bprev (of :bp) - go to previous buffer
  • :bd - delete a buffer (close a file)
  • :sp filename - Open a file in a new buffer and split window
  • ctrl+ws - Split windows
  • ctrl+ww - switch between windows
  • ctrl+wq - Quit a window
  • ctrl+wv - Split windows vertically
Source : http://www.worldtimzone.com/res/vi.html

Sunday, November 08, 2009

copying folder in Linux / Unix terminal

cp -r /original/dir /copied/dir

Saving and quiting at Vim

If like me you wonder how the hell to write in Vim, make sure you are in the insert mode(The mode that you can actually write). You can do that by pressing i.

After finishing, you are supposed to save what you have written. So you press Esc button and then write :w. Then you can simply write :q to quit.

Pay attention that you can write commands(:w, :q, ...) in the command line and you can go to command line by pressing Esc button in Vim.

Good luck, it is a powerful editor, but as me, you got a long way a head to learn how to work with it.

Saturday, November 07, 2009

Showing Line Number while editing a file in Vi or Vim

While editing a document at Unix/Linux, press Esc button type

:set number

to have line numbers beside your editor. If you are tired of line numbers, enter the following to turn them off:

:set nonumber

Wednesday, September 30, 2009

chmod Recursive permission change (i.e. in the directory and its sub-directories)

If you have a folder with a lot of files and sub-folders inside it and you want to change permission on all the files, then you should run chmod command(changing permission to xxx) with a -R at the end.

chmod -R 777 (folder name)

in case you got the error that you do not have permission, you have to login as root(su command and then password)at Ubuntu run :

sudo chmod -R 777 (folder name)

Tuesday, September 29, 2009

compiling and installing software from Source Code

Some software is distributed in "Source form". This means you download a file containing all the source code for the application you want to install, unpack it, and compile it on your system. Compiling is the process of turning the source code into an executable binary. The common myth and newbie assumption is that this is very hard todo, or it is only for programmers. Wrong. It is a fairly straight forward process, and you will find that a lot of software you install will need to be built from source.

Typically applications you must compile from source will come as a ".tar.gz", ".tar.bz2", or ".zip" file.

You'll probably want to operate from inside your home directory. If your user is (for example) username, your home directory will be /home/username/. For the rest of this section we will assume you have downloaded your zip file to /home/username/src. If you do not have a src directory, you can create it with the following "mkdir" (make directory) command:

Code:
mkdir /home/username/src/
So, we have our source package in /home/username/src/.

Change to the /home/username/src/ directory with the "cd" (change directory) command like so:

Code:
cd /home/username/src/
Use the "ls" (list directory contents) command, to see the file is present:

Code:
ls

We now need to unzip the zipped file, this is done differently depending on the file extension.

for files ending in .tar.gz, use:
Code:
tar -zxvf 
(replacing with the name of the file).

for files ending in .tar.bz2, use:
Code:
tar -jxvf 
for files ending in .zip, use:
Code:
unzip 
You should now have a new directory, containing all of the source files. To confirm it exists, and to get its name, use the "ls" command again.
Code:
ls
we now need to go into the new directory, so use the cd command:
Code:
cd 



This is where things will differ. Some packages will have an INSTALL or README file which will contain installation instructions. use "ls" to see if the software has an install or readme file. If it does have one, you can use the "more" command to read it, like so:
Code:
more INSTALL
Generally, the final 3 stages are as follows:
- Configure the installation
- Compile the software
- Install the binaries

The pre-installation configuration is done by executing ./configure:
Code:
./configure
This will perform some requirements testing on your system, and create a "Makefile" which will explain to the "make" utility how the software should be compiled. If you receive any error messages during this stage, you may wish to search the forums to see if they have been found and resolved by someone else already, if not, feel free to post a question on the forums - Please include all of the output including any error messages, and some details about your system - what distro you are using, what are you trying to install etc etc


The next stage is to compile the software, this is done using "make". When you run "make" it will read the instructions in the Makefile and build the application binaries.
Code:
make

The final stage is to install these binaries, ie, copy them to a more permanent location. Typically only the "root" user can do this, so you will need to swich to the root user with the "su" command:
Code:
su
Once you are root, install the binaries using the "make" command, followed by "install", like so:
Code:
make install
That is it! Check the user documentation of the software you installed for details of how to run the application.

Remember that if you have any problems, please post in the most relevant section of the forums. - When posting, remember to include as much info as possible, including all output and error messages.
SOURCE

Saturday, September 26, 2009

RAR @ Fedora ...

By default, Rar is not available in Fedora 10. If all you need to do is extract files from a Rar archive, unrar from RPM Fusion's YUM repositories will work. If you need to create Rar archives, then you will have to download and install the complete Rar package from DAG. The instructions below show you how.

Only Need to Extract Files?

First, install RPM Fusion's free and nonfree YUM repositories. For detailed information about installing RPM Fusion, see: http://rpmfusion.org/Configuration

su -c "rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm"

su -c "rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm"

Next, install the unrar packages from RPMFusion's nonfree repository.

su -c "yum install unrar"

Done! You now have unrar in /usr/bin/unrar. This binary can only extract files from Rar archives. Use this command to see all available options:

/usr/bin/unrar -?

Need to Create Rar Archives?

First, download the source RPM from DAG: http://dag.wieers.com/rpm/packages/rar

wget -c http://dag.wieers.com/rpm/packages/rar/rar-3.5.1-1.rf.src.rpm

Now, install the source RPM. This will create a $HOME/rpmbuild tree. Please note that you do not need to be root.

rpm -iv rar-3.5.1-1.rf.src.rpm

Next, build a binary package in $HOME/rpmbuild. Again, no need to be root.

rpmbuild -bb ~/rpmbuild/SPECS/rar.spec

Finally, install the built RPM as root:

su -c "rpm -Uvh $HOME/rpmbuild/RPMS/$(arch)/rar-3.5.1-1.rf.x86_64.rpm"

Done! You now have rar in /usr/bin/rar. This binary can build and extract Rar files. Use this command to see all available options:

/usr/bin/rar -?

Thursday, September 24, 2009

Flash Fix @ Ubuntu ...

My flash If you want to completely remove all flash plugins(& install again later), run the following command and then delete the related plugins inside ~/.mozilla/plugins, if there are any:

Code:
sudo apt-get remove swfdec-mozilla
sudo apt-get remove mozilla-plugin-gnash
sudo apt-get remove adobe-flashplugin
sudo apt-get remove flashplugin-nonfree
Keep in mind this will also remove flash plugin from Opera, since it's not Firefox that installed the flash plugin. The flash plugin installation is generic for all browsers.

Nevertheless, I believe your problems is due to conflicting plugins. So before trying to remove all flash plugins, try this(IT WORKED FOR ME):

Code:
sudo apt-get remove swfdec-mozilla
sudo apt-get remove mozilla-plugin-gnash
sudo apt-get remove adobe-flashplugin
sudo apt-get remove flashplugin-nonfree
sudo apt-get install flashplugin-nonfree
From my experience, flash does not play well on any browser. Nevertheless, you might experience better performance with Firefox 3.5.3, which is faster than Opera. The alpha releases of Chromium and Firefox 3.6.1a are the best for flash.

You can also try to improve your flash experience using my tutorial Firefox optimization and troubleshooting thread.
Source : Ubuntu Forums

Saturday, September 05, 2009

VLC on Feodra ...

$> su -
#> rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
#> yum install vlc
#> yum install mozilla-vlc (optionnal)

Monday, August 31, 2009

Rar files, Linux

Open a terminal and run following commands :

sudo apt-get install rar
sudo ln -fs /usr/bin/rar /usr/bin/unrar

After that you can find Archive Manager in the Gnome menu under Applications -> Accessories.

Saturday, August 29, 2009

Your IP @ Ubuntu

Run Terminal and type :

#sudo ifconfig (eth0:for cable, or wlan0;for wireless)