12:06 PM Some unique and special commands in Linux |
Lets see some unique and important commands in Linux operating system
Click on a command to expand/collapse rcpThis command is used to copy files remotely from one machine to another.
DESCRIPTION Rcp copies files between machines. Each file or directory argument is either a remote file name of the form ``rname@rhost:path'', or a local file name (containing no `:' characters, or a `/' before any `:'s). SCPscp is a program used to copy files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1). Unlike rcp(1), scp will ask for passwords or passphrases if they are needed for authentication.
Formate: scp [[username]@host1]:file1 [[username]@remote-host2]:[dir]
For eg. To copy a file from your system to any other system, use below command user1@host1:~> scp abc1.txt host2:~/test Enter Your Windows Password: abc1.txt 100% 19 0.0KB/s 00:00 The above command will copy the file abc1.txt of home directory of host1 to the ~/test directory of host2 If you dont specify any directory on the destination host, the file will be copied to home directory of remote host. Lets say: See below command:
user1@host1:~> scp abc1.txt host2: Enter Your Windows Password: abc1.txt 100% 19 0.0KB/s 00:00 Printer related commands lpThis command is used to send jobs for printing. If no printer specified, it will use the default destination. DESCRIPTION
lp submits files for printing or alters a pending job. Use a filename of "-" to force printing from the standard input. The format is: SYNOPSIS lp [ -E ] [ -c ] [ -d destination ] [ -h server ] [ -m ] [ -n num-copies [ -o option ] [ -q priority ] [ -s ] [ -t title ] [ -H handling ] [ -P page-list ] [ file(s) ] Eg. Prompt:> lp abc.txt {ENTER} The file abc.txt will be sent for printing to the default printer You can use -d destination to specify the destination printer -h hostname Specifies the print server hostname. The default is "localhost" or the value of the CUPS_SERVER environment variable. lprSame as lp, It also sends jobs for printing, if no destination specified, it used the default destinations.
Format: lpr [ -E ] [ -P destination ] [ -U username ] [ -# num-copies [ -l ] [ -o option ] [ -p] [ -r ] [ -C/J/T title ] [file(s) ] DESCRIPTION lpr submits files for printing. Files named on the command line are sent to the named printer (or the system default destination if no destination is specified). If no files are listed on the command-line lpr reads the print file from the standard input. lpadminThis command configure cups printers and classes Format: lpadmin [ -E ] [-U username ] [ -h server[:port] ] -d destination lpadmin [ -E ] [-U username ] [ -h server[:port] ] -p printer option(s) lpadmin [ -E ] [-U username ] [ -h server[:port] ] -x destination DESCRIPTION lpadmin configures printer and class queues provided by CUPS. It can also be used to set the server default printer or class. Example: lpadmin -U user1 -h cups-server:portno -p printer1 -v lpd://remoteserver/printer1 -o printer-is-shared=false -o printer-error-policy=retry-job -E lpadmin -U user1 -h cups-server:port -p printer2 -v lpd://remote-server/printer2 -o printer-is-shared=false -o printer-error-policy=retry-job -E lpstatThis command shows the status of a CUPS printer. lpinfoThiscommand show available devices or drivers lppasswdlppasswd - add, change, or delete digest passwords.
Format: lppasswd [ username ] lppasswd -a [ -g groupname ] username lppasswd -x username DESCRIPTION lppasswd adds, changes, or deletes passwords in the CUPS digest password file, passwd.md5. When run by a normal user, lppasswd will prompt for the old and new passwords. When run by the super-user, lppasswd can add new accounts (-a user- name), change existing accounts (username), or delete accounts (-x username) in the digest password file. Digest usernames do not have to match local UNIX usernames. lpclpoptionspsThis command shows all the currently running processes
DESCRIPTION:
ps displays information about a selection of the active processes. If you want a repetitive update of the selection and the displayed information, use top(1) instead. It shows information in below format:
UID PID PPID C STIME TTY TIME CMD
UID -> User Id of the starter of the process
PID -> Process id of the process
PPID -> Process id of the parent process
C ->
STIME -> start time
TTY
TIME ->Duration by which the process is running
CMD -> The command to start the process
Example:
Prompt:>ps -fu userName
This command will list all the process started by "userName"
Prompt:>ps -aef
This command will list all the process started by any user on the Linux machine. To see the every process on the system using BSD syntax, we can use folowwing command: ps -aux ps -ax manThis command shows a help manual of any other command. It accepts a command-name as argument and shows a detailed help manual on that command.
Example: Prompt:>man top Prompt:>man man topLike ps, top command also shows currently running processes but it also updates their status repeatedly.
Prompt:>top {} top - 12:59:25 up 82 days, 2:31, 6 users, load average: 0.31, 0.38, 0.36 Tasks: 257 total, 1 running, 255 sleeping, 0 stopped, 1 zombie Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 32782M total, 31096M used, 1685M free, 185M buffers Swap: 1027M total, 87M used, 940M free, 26222M cached It displays following details: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND The command starts a display where all active processes are shown. It keeps on updating the values like % of CPU usage, % of memory usage, time the process is up by etc. whoamiThis command tells you who you are. It will tell the username who is logged on currently. For Eg. DESCRIPTION Print the user name associated with the current effective user ID. Same as id -un. Prompt:>whoami{Enter} user1 xevThis command is ued to log the keyboard events. It starts an event tester and generates a log for evry keys pressed on the keyboard.
DESCRIPTION Xev creates a window and then asks the X server to send it events whenever anything happens to the window (such as it being moved, resized, typed in, clicked in, etc.). You can also attach it to an existing window. It is useful for seeing what causes events to occur and to display the information that they contain; it is essentially a debugging and development tool, and should not be needed in normal usage. For eg. Below is the log of Shift key and Enter key. Notice the 3rd line which gives the keycode , the key pressed and the screen where pressed. KeyPress event, serial 23, synthetic NO, window 0x400001, root 0x54, subw 0x0, time 759929, (601,628), root:(605,654), state 0x0, keycode 61 (keysym 0xffe2, Shift_R), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyRelease event, serial 25, synthetic NO, window 0x400001, root 0x54, subw 0x0, time 760088, (601,628), root:(605,654), state 0x1, keycode 61 (keysym 0xffe2, Shift_R), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False KeyPress event, serial 25, synthetic NO, window 0x400001, root 0x54, subw 0x0, time 761329, (601,628), root:(605,654), state 0x0, keycode 35 (keysym 0xff0d, Return), same_screen YES, " XLookupString gives 1 bytes: (0d) " " XmbLookupString gives 1 bytes: (0d) " XFilterEvent returns: False KeyRelease event, serial 25, synthetic NO, window 0x400001, root 0x54, subw 0x0, time 761469, (601,628), root:(605,654), state 0x0, keycode 35 (keysym 0xff0d, Return), same_screen YES, " XLookupString gives 1 bytes: (0d) " XFilterEvent returns: False xmodmapThis command is used to remap the keyboard keys from one to another or as per user's choice. Suppose your Enter key is not working, you can use your right shift key by mapping Enter key to the it.
DESCRIPTION The xmodmap program is used to edit and display the keyboard modifier map and keymap table that are used by client applications to convert event keycodes into keysyms. It is usually run from the user's session startup script to configure the keyboard according to personal tastes. So to map the right shift key to your enter key, use below command: xmodmap -e "keycode 61=Return" xmodmap -e "keycode 35=Shift_R" The format is: xmodmap -e EXPRESSION. The expression can be: keycode NUMBER=KEYSYMNAME This mapping will persist only in the logged session, if you want it make it permanent, you have to execute below command. xmodmap -pke >~/.Xmodmap It will create a file Xmodmap in your home directory. Then create one more file called .xinitrc in your home directory where you have to enter this line: xmodmap .Xmodmap pingThis command is used to ping an ip-address or server to find if the host is in the n/w or reachable. It takes ip address or ip-name as argument.
DESCRIPTION: ping uses the ICMP protocol's mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway.
Linux-Prompt:> ping serverOrIP PING serverOrIP (1.2.3.4) 56(84) bytes of data. 64 bytes from serverOrIP (1.2.3.4): icmp_seq=1 ttl=58 time=0.365 ms 64 bytes from serverOrIP (1.2.3.4): icmp_seq=2 ttl=58 time=0.435 ms 64 bytes from serverOrIP (1.2.3.4): icmp_seq=3 ttl=58 time=0.345 ms --- serverOrIP ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2005ms rtt min/avg/max/mdev = 0.345/0.381/0.435/0.044 ms On failure: It says: Unknown host or ping failure.
netstatThe command shows all the active internet connection.
DESCRIPTION: Netstat prints information about the Linux networking subsystem. The type of information printed is controlled by the first argument, as follows: (none) By default, netstat displays a list of open sockets. If you don't specify any address families, then the active sockets of all configured address families will be printed. It shows following information: Proto Recv-Q Send-Q Local Address Foreign Address State nmapThe command accepts ip-address or Ip-name as argument. It is used to show the status of all open ports on that IP-address.
DESCRIPTION Nmap ("Network Mapper") is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. While Nmap is commonly used for security audits, many systems and network administrators find it useful for routine tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. Eg. Prompt:>nmap ServerOrIP Starting Nmap 4.75 ( http://nmap.org ) at 2014-02-20 11:41 CET Interesting ports on ServerOrIP (10.252.103.22): Not shown: 991 closed ports PORT STATE SERVICE 25/tcp open smtp 80/tcp open http 139/tcp open netbios-ssn 443/tcp open https 515/tcp open printer 631/tcp open ipp 843/tcp open unknown 9100/tcp open jetdirect 50003/tcp open unknown Nmap done: 1 IP address (1 host up) scanned in 6.61 seconds
sshhistory
chmod
chown
|
|
Related blogs
You may also like to see:
[2016-10-12] | [Open System-Linux] |
Remove Control M characters from a script or any file in Linux/AIX |
[2014-02-23] | [Open System-Linux] |
lwp-download: A command in linux to downlaod large files from internet |
[2014-11-19] | [Open System-Linux] |
ETHTOOL : A tool in Linux to display or change ethernet card setting |
[2014-10-24] | [Open System-Linux] |
HEXDUMP command in Linux to display the file content in decimal, hexadecimal, octal format |
[2016-04-14] | [Open System-Linux] |
AT command in Linux : schedule a task at later time |
Total comments: 0 | |