Write a shell script to print given number in reverse order in Unix?
# Algo:
# 1) Input number n
# 2) Set rev=0, sd=0
# 3) Find single digit in sd as n % 10 it will give (left most digit)
# 4) Construct revrse no as rev * 10 + sd
# 5) Decrment n by 1
# 6) Is n is greater than zero, if yes goto step 3, otherwise next step
# 7) Print rev
#
if [ $# -ne 1 ]
then
echo "Usage: $0 number"
echo " I will find reverse of given number"
echo " For eg. $0 123, I will print 321"
exit 1
fi
n=$1
rev=0
sd=0
while [ $n -gt 0 ]
do
sd=`expr $n % 10`
rev=`expr $rev \* 10 + $sd`
n=`expr $n / 10`
done
echo "Reverse number is $rev"
What is the difference between the ls and ls -al commands?
ls --> will list the files and directories
but
ls -a --> will list the hidden files too,
by
Dhanush M
If you compiled it yourself, you should usually place it in /usr/local
What type of license does the KDE currently use?
Most of KDE is available under the GNU GPL. Some programs, such as Kate / KWrite are available under the GNU LGPL.
What are the programs 'gdm' and 'kdm' used for?
The GNOME Display Manager (GDM) and KDE Display Manager (KDM) are X display managers that allows a user to start an X session on an X server.
In other words, the display manager shows the login screen when nobody is logged in. After it checks your username and password, it hands off the work to the actual display manager (e,g, GNOME, KDE, Xfce, LXDE).
GDM uses the GTK windowing toolkit, while KDM uses the KDE counterpart, Qt.
Up to DebianLenny, the default /bin/sh shell was bash. Starting with DebianSqueeze, the default shell will be dash.
If for example we wanted to make i subdirictory called foo
in Linux or UNIX it you use
mkdir foo
to change into it you would use
CD foo
to remove the directory
rmdir foo
but this will only work if the directory is empty
to remove the directory called foo when it is not empty use
rm -rf foo
but please be sure this is what you really want to do.
How can varnish be setup to cache pages?
Varnish can be set up to cache pages by configuring its default caching behavior in the Varnish Configuration Language (VCL). You typically define rules in the vcl_recv subroutine to specify which requests should be cached and under what conditions, such as checking for specific HTTP headers or request methods. In the vcl_backend_response subroutine, you can set the cache duration using the beresp.ttl directive to control how long the cached content remains valid. Finally, ensure that the cache is invalidated appropriately when the underlying content changes, using cache purging strategies.
What is the difference between Linux and Windows in terms of interprocess communication?
They have different models of interprocess communication.
In Windows, processes generally communicate to each other by sending "messages". These messages can carry some data.
In Linux processes can communicate in a number of ways:
* Sending Signals to each other (used for simple signalling, the signals do not carry data). * Using files and network sockets, which allows two-way communication between processes, but involves more programming overhead. * Other IPC (interprocess communication) methods such as System-V message queues, semaphores, and shared memory.
What directories must reside on the same filesytem partition as the root directory?
/bin/ - Binary for all users
/dev/ - Device files
/ect/ - Mounted file systems
/lib/ - Program library
/sbin/ - System Admin Binary
xhost is server access control program for X.
xhost + means is Access is granted to everyone
How do Windows 7 and Linux talk in a crossover?
You really need to define your terms better. "Talk" I can sort of figure out, but "in a crossover" is a mystery, unless you're talking about a crossover cable. A crossover cable is just a regular UTP ethernet cable with two pairs of wires swapped ("crossed over") in the middle, allowing two devices with 10/100-Base T ports to communicate directly without using a hub or router.
The operating system has pretty much nothing to do with it, other than that both of them need to support the same communications protocol. Anything that uses standard "TCP/IP" protocol meets this requirement.
Are system calls part of kernel?
Yes, they are the interface to kernel functionality. To quote wikipedia: a system call is how a program requests a service from an operating system's kernel that it does not normally have permission to run
cat command concatenates files and prints on the standard output.
1. If you specify only one file it will just display that file
2. If you specify multiple files they will be displayed one after the other.
What is the difference between the root directory your home directory and your working directory?
The root directory is the top level directory of the entire file system. Every branch starts from there.
The current working directory is where you happen to be in the tree at the moment. If the root is always "/" and my process is in the directory /usr/local/bin/test/data, then the root directory is still "/" and my working directory is currently /usr/local/bin/test/data
What would you need to upgrade your Linux kernel?
To upgrade your Linux kernel / compile a newer version, you would need:
1. A working copy of GCC supported by the kernel version.. The latest GCC and the latest kernel version should be fine.
2. Preferably either the ncurses or GTK development libraries. It is possible to configure the kernel without these, but you either need a previous configuration or a lot of patience using the old question/answer configuration script.
3. Enough free space on your computer for the kernel sources. 100 MB should be fine; this isn't really an issue on modern computers.
4. A competent understanding of what components are needed for your computer. Most of the device support should be easy, but many people get confused in the networking section.
Is a copy of an outgoing letter used as a file copy?
I assume by 'outgoing letter' you mean an email? If so, then a copy of the email can be found in the Sent folder, found below Inbox.
Some task that can be done with the Linux conf tool?
what are some of the tasks that can be done with the lunax conf tool?.
How do you take a single line of input from the user in a shell script?
In "bash" shell it can be achieved with command "read"
#!/bin/bash
echo "Hi There, what is your name?"
read name
echo $name
The central module of an operating system. It is the part of the operating system that loads first, and it remains in main memory. Because it stays in memory, it is important for the kernel to be as small as possible while still providing all the essential services required by other parts of the operating system and applications. Typically, the kernel is responsible for memory management, process and task management, and disk management. The definition of kernel is "the portion of an OS (Operating System) that is responsible for interacting with the hardware. It is the operating system software that runs in kernel mode on the computer's processor and which provides low-level intelligence for the operating system. In other words, the kernel is the "heart" of an operating system.