lpr command is used to give file for printing to the destined printer.
there are few options for lpr command
-P prints file to the named printer or give address of printer
-# sets number of copies to be printed between 1 to 100
for example
lpr -P addressofprinter -# 4 filename1 filename2
you can print multiple files at a time. number after -# is number of copies to be printed.
Sunday, June 2, 2013
Saturday, May 18, 2013
What is grep command: linux
grep command is used to search a particular pattern in the given input.
for example in snap shot.
first we display content using cat just to check file content
$cat filename
then give any word which you want to search
$grep "string-name" filename
this displays the entire line in which this string-name appears
if you want to search case insensitve word then just put option -i
$grep -i "string-name" filename
if some word is not found in file then it displays nothing
for more details about grep you can go to manual page entry by running
$man grep
for example in snap shot.
first we display content using cat just to check file content
$cat filename
then give any word which you want to search
$grep "string-name" filename
this displays the entire line in which this string-name appears
if you want to search case insensitve word then just put option -i
$grep -i "string-name" filename
if some word is not found in file then it displays nothing
for more details about grep you can go to manual page entry by running
$man grep
Sunday, March 3, 2013
I Accidentally Removed "/usr/sbin" : How to recover it in Linux
whenever you run rm command be carefull.first run ls and see what are the files and folders going to be deleted.then only run rm.rm * deletes all the contents in current directory.which may destroy your system.
some possibilities to recover deleted directory /usr/bin :it contains all system binary files.
1> go to rescue mode and try to restore. or upgrade using CD/DVD.
or
2>try copying the same directory /usr/sbin from some other operating system(prefer the same Operating System and (if possible)same version )
to copy the directory
1> go to terminal during system boot
2>run su
3>run cp xyz /usr/
where xyz is path for the directory sbin
some possibilities to recover deleted directory /usr/bin :it contains all system binary files.
1> go to rescue mode and try to restore. or upgrade using CD/DVD.
or
2>try copying the same directory /usr/sbin from some other operating system(prefer the same Operating System and (if possible)same version )
to copy the directory
1> go to terminal during system boot
2>run su
3>run cp xyz /usr/
where xyz is path for the directory sbin
Thursday, February 28, 2013
How to Count no. of files/directory in a directory
> go to directory (here DistSys) in which you have to find no. of files and folders
>now run ls command and pipe it's output to command " wc -l "
cd DistSys
then
ls | wc -l
which gives a number say 11 ,which means directory DistSys contains 11 files or folders.
Thursday, February 21, 2013
How to create your own command in linux
write any script.for example i want to add command which displays present
working directory with list of files or folders under it.then type following in gedit or any editor
#!/bin/bash
echo "present directory is `pwd` "
echo "files are `ls` "
save it with any name say pwdfiles
now make it executable
chmod +x pwdfiles
now copy it to /usr/bin directory.
cp pwdfiles /usr/bin/
Sunday, February 17, 2013
How to set Default Boot Option to Windows OS or Vista
which resides under /boot/grub directory.
boot screen will look like this...
and each options are numbered from 0 to n( 7 here )
Ubuntu,with linux 2.6.35-23-generic =0
Ubuntu,with linux 2.6.35-23-generic(recovery mode)=1
Ubuntu,with linux 2.6.35-22-generic =2
Ubuntu,with linux 2.6.35-22-generic(recovery mode)=3
Memory test (memtest86+) =4
Memory test(memtest86+,serial console 115200) =5
Windows Vista (loader) (on /dev/sda1) =6
Windows Vista (loader) (on /dev/sda2) =7
now in grub.cfg file set default="7" to keep default boot windows vista
and to keep ubuntu as default boot
set default="0"
Wednesday, February 13, 2013
Installation Error, “Unable to lock the administration directory”
this error occurs during installation of software when lock file is being modified
by some other process or when you are trying to install two different software at
the same time so get rid of this problem
1>install one software at a time
but the problem still persist then
run the following command
rm /var/lib/dpkg/lock
this command removes lock over lock file.location of the file may be different in
different linux operating system
Subscribe to:
Posts (Atom)