Posts

Showing posts from March, 2014

A few linux command to play with.

 A few linux commands to play with. Your distro may vary. 1. SYSTEM $ uname –a                       => Display linux system information $ uname –r                       => Display kernel release information (refer uname command in detail) $ cat /etc/redhat_release        => Show which version of redhat installed $ uptime                         => Show how long system running + load (learn uptime command) $ hostname                       => Show system host name $ hostname -i                    => Display the IP address of the host (all options hostname) $ last reboot                    => Show system reboot history (more examples last command) $ date                           => Show the current date and time (options of date command) $ cal                            => Show this month calendar (what more in cal) $ w                              => Display who is online (learn more about w command) $ whoami                         => Who you are logge

A few linux command to play with.

 A few linux commands to play with. Your distro may vary. 1. SYSTEM $ uname –a                       => Display linux system information $ uname –r                       => Display kernel release information (refer uname command in detail) $ cat /etc/redhat_release        => Show which version of redhat installed $ uptime                         => Show how long system running + load (learn uptime command) $ hostname                       => Show system host name $ hostname -i                    => Display the IP address of the host (all options hostname) $ last reboot                    => Show system reboot history (more examples last command) $ date                           => Show the current date and time (options of date command) $ cal                            => Show this month calendar (what more in cal) $ w                              => Display who is online (learn more about w command) $ whoami                         => Who

Linux usage starts at birth.

Image
 Cute video of using a computer to rock a baby. ( https://www.youtube.com/watch?v=bYcF_xX2DE8 ) Bash code used in movie? while [1 = 1]  do     #eject cdrom     eject     #pull cdrom tray back in     eject -t  done

Socket to me.

The ability to get data from one computer to another is essential for one or more computers on a network. What happens that one computer essential becomes a host/server and the other computer the client, A good example of this might be a networked game, but it all starts with a simple peiece of code that can get more complicated as the need arises. The server code for this simple example. Server.c #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <time.h> int main(int argc, char *argv[]) { int listenfd = 0, connfd = 0; struct sockaddr_in serv_addr; char sendBuff[1025]; time_t ticks; listenfd = socket(AF_INET, SOCK_STREAM, 0); memset(&serv_addr, ’0′, sizeof(serv_addr)); memset(sendBuff, ’0′, sizeof(sendBuff)); serv_addr.sin_family = AF_INET; serv_

Record your command line..

Image
Sometimes every once in a while, you find an old generally unused command, but now you find it is very valuable. One such command is know as ttyrec. As the name suggests, you can probably record what is typed at the terminal.   This is excellent for documentation purposes. It is a must for people who do any amount of work on the command line.  An example: recently did a remote install of Arch linux on a remote machine.  It would have been nice to have a record of all the work done. # sudo apt-get install ttyrec Well how do you use it? There are actually two parts of the system. ttyrec does the recording and ttyplay  will playback what you have recorded.  So you will want to invoke ttyrec with a filename (for later playback,) which will generate a new shell or prompt.  Go ahead and type in the commands you want to do, then when you are finished, use <control>d to exit the the recording. You will see the word exit to confirm the exit of the ttyrec program. $ ttyrec filename