If you want to try out linux commands without bothering to to through installation then try the free online linux terminal to practice commands.
This is simple
This has some additional features :
Linux gives us lot of general commands and we have to use a lot many commands to finish a specific task. What if we can create our own command and fire them to do our specific task / repetitive task.
You care create alisa which can contain set of commands. For example each time when I have to check if mongo is running on my box I have to type a big command, how about being creative a publish command with name psm => which means it will ps all process and will figure out the mongo process 😉
alias psm=”ps -eaf | grep mongo”
syntax : alias commandName=“cmd1 ; cmd 2 ; cmd 3”
To persist alais as command forever, save that in .bash_profile
and reload it using command source ~/.bash_profile
# create your own command for session
> unalias prem => will remove the alias for that session, you might want to remove from .bash_profile to remove it permanently.
The “inode” is sometimes referred to as an index node. But what is it? Basically, it is a file structure on a file system. More easily, it is a “database” of all file information except the file contents and the file name.
In a file system, inodes consist roughly of 1% of the total disk space, whether it is a whole storage unit (hard disk,thumb drive, etc.) or a partition on a storage unit. The inode space is used to “track” the files stored on the hard disk. The inode entries store metadata about each file, directory or object, but only points to these structures rather than storing the data. Each entry is 128 bytes in size. The metadata contained about each structure can include the following:
NOTE: the metadata does not include the file’s name.
Rather than the name, the inode of each file uses a pointer to point to the specific file, directory or object. The pointer is a unique number which usually is referred to as the inode number. For example, to get a listing of an inode number, use the following command:
$ ls –i filename
You can use the “stat” command to get more information than the inode number:
$ stat filename
A sample output is shown for both commands:
ls –i Journal.rtf buse@Buse-PC:/media/buse/Norton$ ls -i ./Journal.rtf 160 ./Journal.rtf
stat –i Journal.rtf buse@Buse-PC:/media/buse/Norton$ stat ./Journal.rtf File: ‘./Journal.rtf’ Size: 22661 Blocks: 48 IO Block: 4096 regular file Device: 811h/2065d Inode: 160 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/ buse) Gid: ( 1000/ buse) Access: 2013-05-26 00:00:00.000000000 -0400 Modify: 2013-05-26 17:58:04.000000000 -0400 Change: 2013-05-26 17:58:02.180000000 -0400 Birth: -
In these cases, you can see that the inode number for the Journal.rtf file is 160 for both commands. An inode number can only change if the file is moved.
For example, the previous output came from the file Journal.rtf. If the file is moved to a different directory, the commands are executed again, the inode numbers are different:
ls –i Journal.rtf buse@Buse-PC:/media/buse/Norton/test$ ls -i ./Journal.rtf 372 ./Journal.rtf
stat –i Journal.rtf buse@Buse-PC:/media/buse/Norton/test$ stat ./Journal.rtf File: ‘./Journal.rtf’ Size: 22661 Blocks: 48 IO Block: 4096 regular file Device: 811h/2065d Inode: 372 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/ buse) Gid: ( 1000/ buse) Access: 2013-05-26 00:00:00.000000000 -0400 Modify: 2013-05-26 17:58:04.000000000 -0400 Change: 2013-05-26 17:58:02.180000000 -0400 Birth: -
Screen – keep the session window process running in back ground even when you close it. It can be listed, attached and detached on need basis.
# List all existing screen on the shh or connected box
$ screen -ls
# connecting a screen / resume to a screen
$ screen -r <screen name>
# exit and leave application open
$ Ctrl + a, d
# Creating a screen
$ screen -S <screen name>
# Killing or deleting existing screen (attached or detached)
$ screen -S <some_name> -X quit
I connected a linux box, started, app server , tested it and when closed my session, all processes in that session got killed automatically. QA reported that the app server has stopped working. I again connected started and moment i closed session same thing happened. Then my friend @rey told that one your session closes all process related to that session gets killed automatically, so he recommended me to use “Screen” so that even when i exit all my process will continue. I can name the screen and can resume it later, use history and it has several other benefits.
one could log into a system remotely, start screen, work, detach from the screen session, then reattach to it at a later time, in a different location, over a different connection. This is a great way to make sure you don’t lose work if you are remotely logging in over an unreliable connection.