Skip to main content

Posts

Linux Network Bandwidth check Script.

Recent posts

Block certain file extensions on samba linux

Samba offers an option to block files with certain patterns, like file extensions. This option can be used to prevent dissemination of viruses or to disuade users from wasting space with certain files:

$ vim /etc/samba/smb.conf

[Vishal]
comment = vishalvyas
Path = /home/vishal
public = yes
writable = yes
browseable = yes
read only = no
valid user = vishal
create mask = 0775
Veto files = /*.exe/*.com/*.dll/*.bat/*.vbs/*.tmp/*.mp3/*.avi/*.mp4/*.wmv/*.wma/

Thanks,
Vishal Vyas

How to increase swap size in linux

Swap is a type of filesystem and is a virtual memory. Whenever your RAM is full, your operating system will look for further memory in your swap space. For this reason, you reserve some part of the hard disk to create a swap partition.


Identifying Current Swap Space Usage:

root@vishal-desktop:/# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/sda7                               partition       1951740 4       -1

Alternatively, use the swapon command:

root@vishal-desktop:/# swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda7                               partition       1951740 4       -1


Finally, the free command may also be used:

root@vishal-desktop:/# free
             total       used       free     shared    buffers     cached
Mem:        895112     721656     173456          0      36592     310156
-/+ buffers/cache:     374908     520204
Swap:      1952736          4    1952732


Adding a Swap F…

Monitoring User Activity with psacct On Linux

One of the big advantages of using psacct on your server is that it provides excellent logging for activities of applications and users.




Installation :-

for Redhat, Fedora, CentOs

yum install psacct
service psacct start

For Ubuntu Debian

apt-get install acct
service acct start

Following is the list of utilities it includes:
The ac command displays statistics about how long users have been logged on.
The lastcomm command displays information about previous executed commands.
The sa command summarizes information about previously executed commmands.
The accton command turns process accounting on or off.

How to use psacct :

The connect time in hours is based on logins and logouts. 

root@Vishalvyas:~#  ac -p
        vishal                        9.12
        Ashish                      20.60
        Vipul                        15.80
        Anil                          17.33
        Akshay                     10.92
        pritesh                      4.10
        chirag                       8.75
       …

Vim Advanced Text Editor

Vim is a text editor written by Bram Moolenaar and first released publicly in 1991. Based on the vi editor common to Unix-like systems, Vim is designed for use both from a command line interface and as a standalone application in a graphical user interface. Vim is free and open source software,The name "Vim" is an acronym for "Vi IMproved"[6] because Vim is an extended version of the vi editor, with many additional features designed to be helpful in editing program source code.








Vim also has a built-in help facility (using the :help command) that allows users to query and navigate through commands and features.

VIM An Advanced Text Editor:-
=> Newer Virsion of VI, the standard Unix text editor

=> gvim :         Graphical Version of vim

ADVANTAGES OF VIM :-

SPEED            : Do more with fewer keystrokes
Simplicity        : No dependence on mouse/GUI
Availability      : Included with most Unix-like OSes

DISADVANTAGES :-
Difficulty         : Stteper learning curve than …

Basic linux commands

==>>>Command










- date: to see the date and time - date 112503451982 : month,date,hour,minut,year - cal: to see the calendar - cal 2010: to see the calendar of 2010 - cal 5 2010: display the calendar of May 2010 - clear: to clear the screen - ls: to see the list of dir and file - useradd vishal: to create user with name 'vishal' - passwd vishal: to set & also change password of user 'vishal' - passwd: to root only
- passwd -d vishal: create user without password - usermod -l n-name o-name: to rename user - usermod -g group user: to add user in group - useradd -n vishal: create user without duplicate directory - userdel vishal: to delet user - userdel -r vishal: Delet user with their directory - rm -rf directory: forcefuly remove directory
- groups vishal: to see membarship of user - vi /etc/passwd: see user directory - groupadd sels: create group