Skip to main content

Posts

Showing posts from March, 2017

perl

Perl is a programming language developed by Larry Wall, especially designed for text processing. Though Perl is not officially an acronym but many times it is used as it stands for Practical Extraction and Report Language . It runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. The language is intended to be practical (easy to use, efficient,complete) rather than beautiful (tiny, elegant, minimal).It combines (in the author's opinion, anyway) some of the best features of sed, awk, and sh, making it familiar and easy to use for Unix users to whip up quick solutions to annoying problems.  Its general-purpose programming facilities support procedural, functional, and object-oriented programming paradigms, making Perl a comfortable language for the long haul on major projects, whatever your bent. Perl's roots in text processing haven't been forgotten over the years.It still boasts some of the most powerful regular expressions to be

awk

AWK is a programming language designed for text processing and typically used as a data extraction and reporting tool. It is a standard feature of most Unix-like operating systems. The AWK language is a data-drivenscripting language consisting of a set of actions to be taken against streams of textual data – either run directly on files or used as part of a pipeline – for purposes of extracting or transforming text, such as producing formatted reports. The language extensively uses the stringdatatype, associative arrays (that is, arrays indexed by key strings), and regular expressions. While AWK has a limited intended application domain and was especially designed to support one-liner programs, the language is Turing-complete, and even the early Bell Labs users of AWK often wrote well-structured large AWK programs. AWK was created at Bell Labs in the 1970s,and its name is derived from the surnames of its authors—Alfred Aho, Peter Weinberger, and Brian Kernighan. Learn more on

Pipes and Filters

You can connect two commands together so that the output from one program becomes the input of the next program. Two or more commands connected in this way form a pipe. To make a pipe, put a vertical bar (|) on the command line between two commands. When a program takes its input from another program, it performs some operation on that input, and writes the result to the standard output. It is referred to as a filter. The following are some of the filter commands . Click the commands to see the man page and learn different options. wc - count number of lines words and characters cut - cut the files vertically character or field wise paste - vertically paste two files head - get lines from the beginning of a file tail -get lines from the end of a file sort - sort the files contents grep , egrep , fgrep - search file contents uniq - unique lines from a sorted file join - joining two files tr - translating characters awk -is a full-featured text processing language    Sample s

Free Software

“Free software” means software that respects users' freedom and community. Roughly, it means that the users have the freedom to run, copy, distribute, study, change and improve the software. Thus, “free software” is a matter of liberty, not price. To understand the concept, you should think of “free” as in “free speech,” not as in “free beer”. We sometimes call it “libre software,” borrowing the French or Spanish word for “free” as in freedom, to show we do not mean the software is gratis. The four essential freedoms A program is free software if the program's users have the four essential freedoms:  The freedom to run the program as you wish, for any purpose (freedom 0). T he freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this. The freedom to redistribute copies so you can help your neighbour (freedom 2). The freedom to distribute copies of your modified versions to

Linux...Chronology

1991: The Linux kernel is publicly announced on 25 August by the 21-year-old Finnish student Linus Benedict Torvalds. 1992: The Linux kernel is relicensed under the GNU GPL. The first Linux distributions are created. 1993: Over 100 developers work on the Linux kernel. With their assistance the kernel is adapted to the GNU environment, which creates a large spectrum of application types for Linux. The oldest currently (as of 2015) existing Linux distribution, Slackware , is released for the first time. Later in the same year, the Debian project is established. Today it is the largest community distribution. 1994: Torvalds judges all components of the kernel to be fully matured: he releases version 1.0 of Linux. The XFree86 project contributes a graphical user interface (GUI). Commercial Linux distribution makers Red Hat and SUSE publish version 1.0 of their Linux distributions. 1995: Linux is ported to the DEC Alpha and to the Sun SPARC. Over the following years it is ported to an ev

Other Commands

alias aliasname='command' creates a temporary macro aliasname that executes command chsh changes the shell clear clears the screen crontab maintain crontab files for individual users env < VARIABLE=value> sets environmental VARIABLE to value (blank to show all) kill pid kills process pid . kill –9 pid to force kill (use ps to list pid) newgrp group sets group as the primary group owner for new files created nice -n priority command executes the command with a specified priority renice priority pid changes a program's priority level afterwards (see nice , ps ). script logs everything that you type to . “exit” to quit. sleep time makes the computer wait for time . Try “sleep 30; echo Go” telinit level specifies which runlevel to run at (0 = halt, 1 = single-user, 3 = full multi-user, 5 = X-windows, 6 = reboot) umask permission changes the default file permission for new files (ex: rw-r—r--). umask 077 makes all new files rw------. The pe

Account Administration Commands

groupadd group creates a group called group groups username list the group(s) that username belongs to gpasswd –a –d username group the -a switch adds username to group . The –d switch removes username from group passwd initiates the process for changing your password su switch to a different user or super user sudo command runs command with superuser access (to do this user first neesds to be listed in /etc/sudoers) useradd useradd -c "normal user" -d /home/userid -g users\ -G groupname1,groupname2 -s\ /bin/bash userid userdel –r userid deletes userid (-r to delete home directory)

IO Commands

halt shutdown the system hdparm displays/sets hard drive parameters (try: hdparm -i /dev/hda ) lpq -Pprinter lists the job line of a Pprinter lpr -Pprinter file.ps prints a ready postscript file. See enscript lprm -Pprinter job removes the printing job from Pprinter ( lpq to get job #) mke2fs /dev/fd0 creates ext2/ext3 filesystem (format floppy: mke2fs /dev/fd0 ) mount /dev/ mounts a (ex: mount /dev/fd0 /mnt/floppy). No argument shows currently mounted devices. umount unmounts a device (ex: umount /mnt/floppy) reset resets the terminal (use clear to simply do a clear screen) shutdown brings the system down (to reboot, try shutdown -r now )

Communication/Network Commands

chfn change the info displayed about you when you are fingered finger userID displays login information about the userID indicated ftp host FTP client for connecting to host ifconfig display & configure network interface (like ipconfig) ip address - get all the ip details hostname -I    will get ip address of your machine host ip/name performs DNS lookup on IP or name ifup devicename activates devicename (usually primary NIC card: eth0) ifdown devicename deactivates devicename (usually primary NIC card: eth0) lynx text based WWW browser. q exits the program mesg option sets your account to accept a talk requests ( y or n ). See talk netstat prints various network information (try netstat --inet -a) nslookup ip/name resolves the name (if IP is entered) or IP (if name is entered) ping host sends ping packet (ICMP echo request) to host quota displays disk usage and limits route show and manipulate IP routing tables. No switch shows info. talk userID ini

Information Commands

apropos subject shows commands related to subject (ex: apropos floppy ) If it never finds anything, update db with “ mandb ”as root. cal displays a calendar (ex: “ cal 2004 ” to see all of 2004) date prints or the system’s date and time df lists the amount of diskspace used and available. Putting “.” after the command lists the diskspace on the partition you are using right then. Use –h to convert bytes to KB, MB, GB. dmesg quick view of the boot log from the last system boot du gives the amount of diskspace taken by the directory. Try -h free gives the amount of memory available history displays the last commands that you issued at the prompt hostname prints the name of the machine used id prints information about the user/owner of shell info command similar to the man command but with hyperlinking available last username displays information about previous logins of username ldd program lists the shared libraries required by program lsattr file lis

Directory Commands

cd dir --changes working directory (leave blank for home directory) ls --- lists files and subdirectories (add -a for hidden files/directories, -F to put “/” after directories, -l for details) mkdir --directory makes a new directory pwd --displays the current working directory rmdir ---directory deletes directory (only if it is empty) rm -r directory ----deletes the directory including its subdirectories and files

File commands

File Commands cat filename displays the contents of filename cat filename(s) > newfile copies one or more files to a newly created newfile cat filename >> destination appends the contents of filename to destination chattr  filename changes the file attributes of filename (see lsattr ) chmod permission file_or_dir_name changes file permissions; (u) user's, (g) group's, (o) others' rights can be (+) added or (-) deleted in (r) read, (w) write or (x) execute mode. chmod u+x file adds execute rights to user. chown file---- changes ownership of file to and cp oldfilename newfilename ---copies oldfilename to newfilename file filename ----displays what type of file filename is find / -name “ filename ” searches entire root directory for filename grep string filename searches for and displays the string within filename gunzip filename uncompresses filename (if compressed with gzip ) gzip filename compresses filename (use gunzip to uncompr