Commands On Commands

0 comments

I thought of writing a post on some good comamnds which are capable of running on other commands.

With my knowledge i tried to gather below commands, please share your thoughts/experiences through comments.

1.strace -- very much handy when debugging a command/script which will struck in middle of execution. This command will be tough when you start using it initially, but will come hand when start using excessively. And there are some more sister commands for this ie ltrace mtrace which i never used, please give some inputs on these.

For example if we want to see how ls command is executed and want to see what actually ls command is doing? you can check that out by using
strace
#strace ls

2.watch --used to see a command executino at a regular intervels(by default 2 sec)

Some valuable examples

a.Monitoring a copy activity of CD/DVD, which will show the progress.
#cp -ar /dev/cdrom /mnt &
#watch ls -l /mnt

b.Watching who are connecting to a system and
disconnecting
#watch lsof -i


3.time --To see how much time a command taken to execute, This a handy tool when you want to check how much time your shell script taken to execute.
#time ls
#time shellscript.sh

4.whereis --to find where a command located
#whereis ls

5.whatis --to get one line info on a command
#whatis ls

And a well known man command and info commands to see the details of a command what it can do.
#man ls
#info ls

  • Like the post? Please Subscribe to free RSS feed to get updates
  • How To Install SSH Server In Ubuntu Linux OS?

    0 comments

    By default in Ubuntu SSH(Secure SHell) server is not installed. This is a big problem when you want to access the Ubuntu machines from other machines we can not access. In this post I will show you how to install and SSH server and give you some examples how to use ssh.

    Installing ssh server in ubuntu
    #apt-get install openssh-server
    Once you install now try to login to that machine
    #ssh 0

    Note : In this example i am login to same machine, which i am going to check whether service is running or not. We should get successfully login for the above command which will prompt for password.

    SSH examples:

    Example1 : Login to a remote machine using its hostname
    #ssh servername

    Note : This will allow us to login to remote server on default
    ssh port(22)

    Example2 : Login to a remote machine using its IP add
    #ssh 192.168.0.1

    Example3 : Login in to a remote machine which uses different port for running ssh server
    #ssh 192.168.0.1 2010

    Note : Here SSH server is running on 2010 port(some times this is good practice to secure the system).

    Example4 : Login to a remote machine with different user
    #ssh user@192.168.0.1

    Example5 : Executing commands on remote machine with out login to the machine.
    #ssh 192.168.0.1 "ls -l"

    Note : This command will execute "ls -l" command on remote host:192.168.0.1 and gives the output on a local machine.

    SSH server is a big concept which can not be dealt with in one post. Will try to write another post on SSH server.

  • Like the post? Please Subscribe to free RSS feed to get updates
  • Mount NTFS Partations In Linux Machines.

    0 comments

    How to mount NTFS(New Technology File System) partations in Linux?
    Ans : By default we can not mount ntfs partations, to do that we have two options
    1.Compiling kernle, click here to see how to compile a kernel.
    2.Install Fuse tool and then mount the ntfs partation's.

    Let us start how to install fuse and then mount ntfs partations
    Step1 : Install the following softwares
    #yum install fuse
    #yum install dkms-fuse
    #yum install fuse-ntfs-3g

    If you dont have yum and want to install through rpm, then you have to download the above three packages and install them through rpm command.
    For this you need to download correct versions of above packages from dag weirs repository.


    Repository link is as following:
    http://dag.wieers.com/rpm/packages/

    Step2 : After installing above packages, you need to ensure that "fuse" module is loaded or not, run the below command
    #lsmod grep fuse

    Step3 : If this is not showing any thing, we have to load this fuse module.
    #modprobe fuse

    Step4 : After loading fuse module, run following command to mount ntfs filesystem in linux system
    # mount -t ntfs-3g /dev/hdb1 /media
    Above command will mount ntfs partition in R/W mode.

  • Like the post? Please Subscribe to free RSS feed to get updates
  • Archive

    Translate this page

     

    The Linux Juggernaut | Copyright 2006-2009 Surendra Kumar Anne | Surendra's Home Page | Give us feedback how we are doing, Click here