Linux Setfacl Getfacl ACL examples

Some Basic examples of setting permissions to Files.

Granting an additional user read access

$ setfacl -m u:lisa:r file

Revoking write access from all groups and all named users (using the effective rights mask)

$ setfacl -m m::rx file

Removing a named group entry from a file’s ACL

$ setfacl -x g:staff file

Copying the ACL of one file to another

Methond 1:

$ getfacl file1 | setfacl --set-file=- file2

Method 2:

$ getfacl file1 > acls.txt
$ setfacl -f acls.txt file2

Copying the access ACL into the Default ACL

getfacl --access dir | setfacl -d -M- dir

Remove screen saver from linux

Linux disable screen blanking i.e. preventing screen going blank

It is easy to disable screen saver under X window. But when it comes to text based login or terminal you will not find easy way to disable text based power saving mode (i.e. when your screen goes blank after a few minutes).

So how do I disable the blank screen mode, which activated after a few minutes? Answer is use setterm command.

setterm writes to standard output a character string that will invoke the specified terminal capabilities. Where possible terminfo database (terminfo is a data base describing terminals, used by screen-oriented programs and libraries such as ncurses) is consulted to find the string to use.

By default, the Linux kernel will use screen-save option to disable it you need to type command (it turns off monitor VESA powersaving features):

$ setterm -powersave off -blank 0

If it dumps back you with an error that read as follows:

cannot (un)set powersave mode

You need to shutdown X window system and rerun the above command. Better, add following two commands to your ~/.xinitrc file:

setterm -blank 0 -powersave off -powerdown 0

xset s off

This command also supports other useful options:

Resets the terminal to its power on state:

$ setterm -reset

Alternatively, initialize terminal:

$ setterm -initialize

Turns the terminal’s cursor on or off:

$ setterm -cursor [on|off]

Turns automatic line-wrapping on or off (virtual consoles only)

$ setterm -linewrap [on|off]

Sets the foreground text color (virtual consoles only):

$ setterm -foreground blue

Sets the background text color (virtual consoles only):

$ setterm -background red

Enables or disables the sending of kernel printk() messages to the console (virtual consoles only). Useful if you get lots message from iptables firewall:

$ setterm -msg [on|off]

how to check folder/directory capacity in linux

NAME
du – estimate file space usage
SYNOPSIS
du [OPTION]… [FILE]…
DESCRIPTION

Summarize disk usage of each FILE, recursively for directories.

Mandatory arguments to long options are mandatory for short options too.

-a, –all
write counts for all files, not just directories
-B, –block-size=SIZE use SIZE-byte blocks
-b, –bytes
print size in bytes
-c, –total
produce a grand total
-D, –dereference-args
dereference FILEs that are symbolic links
-h, –human-readable
print sizes in human readable format (e.g., 1K 234M 2G)
-H, –si
likewise, but use powers of 1000 not 1024
-k
like –block-size=1K
-l, –count-links
count sizes many times if hard linked
-L, –dereference
dereference all symbolic links
-S, –separate-dirs
do not include size of subdirectories
-s, –summarize
display only a total for each argument
-x, –one-file-system
skip directories on different filesystems
-X FILE, –exclude-from=FILE
Exclude files that match any pattern in FILE.
–exclude=PATTERN Exclude files that match PATTERN.
–max-depth=N

EXAMPLE

du -s -h /home/user

du -h /home/user

du /home/user

Add proxy Ubuntu 9.10

Also known as : err (22 : invalid argument)

vim ~/.bashrc
add this line at the bottom
export http_proxy=http://domain.com:port

NASA finds water on the moon

 

 

Click Here