Skip to main content

Posts

Showing posts from August, 2016

Excel formula fixed cell address

How to insert a formula with a fixed cell address? Absolute referencing will come to the rescue. Absolute reference in Excel is prefix with a dollar ($) sign. $A$1: This means that Column "A" and Row "1" will not change when copied to another cell. Example:       =SUM(A$1,$A2,$A$1) The above formula when copied from one cell to another cell, $A$1 will remain the same. While A$1,$A2 will change its location when copied to another cell.  A$1: This means that column "A" will change while row location (which is number 1) will not change when copied.  So this absolute reference will change like D$1, G$1 or E$1 depends on the location. So number "1" value will never change.  $A1: The column "A" will not change when copied from one cell to another cell, while the row value which is number "1" will change. So the above absolute reference will change like $A3, $A10, $A12 etc., Column "A" will be const

Hide files in Linux

To easily hide files in Linux prepend the file or directory with a dot "." before its filename or directory name. To view hidden files in Linux use ls -la command. Hidden files in Linux are prepended with "." (dot). To hide a file, use the mv (move) command. mv command will rename the file or directory, if another path is specified aside from the current directory then the file is moved and at the same time it will be renamed, if a new file name is specified. Here's one example: mv hide_salary.txt .hide_salary.txt hide_salary.txt will be renamed to .hide_salary.txt Hiding files does not mean restricting access. It will only hide the file from the user. Proper permissions settings should be defined if restriction is needed. ls -l command will not show hidden files. ls -la command will show hidden files. To unhide the file simply remove the "dot". Unhide a hidden file: mv .hide_salary.txt show_salary.txt

Linux protect file from deletion

To protect file from deletion in Linux system, the chattr command is able to set the attributes that protects the file. chattr +a my_protected_file.txt chattr +a  == means that the file can be appended and the file can't be deleted as well. To set the file to immutable, "+i"  attribute can be used. chattr +i the_protected_file.txt Immutable file is protected from deletion and the original contents of the file is also preserved because no changes can be made. This command below: ls xx*.txt >> the_protected_file.txt The command above will show "permission denied" if the file is immutable. If the file is set with +a, then the above command will append the output of "ls" to the file. To unset or removed the attribute use the minus sign, "-a", "-i". For example, chattr -a the_protected_file.txt or  chattr -i the_protected_file.txt To know more about chattr type the command below: man chattr chattr --help

Folder redirection very slow

Folder redirection is good and bad, well if everything is working as expected then it's definitely good and sometimes it's bad if it causes some unexpected issues such as very slow login. So you have a folder redirection working  smoothly over the years, users can always change their password whenever they want it and of course, System Administrator can also change user password anytime whenever they want it or whenever they just felt like changing it (just kidding), or when situations demand it. If folder redirection suddenly becomes problematic or causes some issue such as slow login, one issue could be that the user changes the password or the Sys Ad change the user password. One issue I encountered if the folder redirection suddenly becomes slow, if the client or the user has a mapped drive that is set manually and set to persistent, persistent mapped drives uses the Vault Credential Manager to store the password. If the password is not updated in the vaul

Map drive not working

Mapping drive can be set in different ways,  via group policy, using scripting (PowerShell, Vbscript, Jscript) or it can be set via command line. Setting script via command line can be done easily using ”net” command, like the example below. The example below shows the syntax on how to map a drive or folder. net use ? The syntax of this command is: NET USE [devicename | *] [\\computername\sharename[\volume] [password | *]]         [/USER:[domainname\]username]         [/USER:[dotted domain name\]username]         [/USER:[username@dotted domain name]         [/SMARTCARD]         [/SAVECRED]         [[/DELETE] | [/PERSISTENT:{YES | NO}]] NET USE {devicename | *} [password | *] /HOME NET USE [/PERSISTENT:{YES | NO}] Example: Net use \\AD_Server\Working_folder   Z: The command will map “Working_folder” to drive Z on the client PC. The above command will not need a password  if run as a batch file and deploy as a logon script via

Linux search string in text files

Search a string or a pattern in text files without opening the file. Grep is a handy tool to find or search a string in text files. Grep is an available tool in Linux and Unix OSes. So if you have some data or information stored in text files and forget where the file is located. As long as you know the keyword or a string to search for, then grep and find command will be your utmost friend. "Grep" and "find" are tools to make life easier to get the information you want but how to use it? Command below will search recursively in the patch specified for all the text files and display the file where the match is found, output will also include the path and the filename. find /home/00_Notes -name '*.txt' -print0 | xargs -0r grep -H 'vanity baseline' The xargs -0r,  is zero r. The above command will search recursively in all folders and subfolders for text files which contains the string "vanity baseline". If a match is

Active Directory GPO apply to forest

How to apply GPO to whole forest? 1. Open GPMC (Group Policy Management Console) and create a GPO for a single domain. 2. Link the GPO to other domains in the forest.    Right click each domain and select "Link an Existing GPO Here" then select the GPO that will be applied to all domains in the forest. 3. If everything works fine, then you're a lucky man. Before rolling out a GPO create a test Organizational Unit and create Active Directory user accounts for test purposes. Then apply the GPO to the OU. If it works properly then there's a good chance that it will work smoothly to all users but it's not a guarantee that it will work correctly to all users. If the GPO is critically needed to be applied to all users and testing works okay, roll out the GPO and troubleshoot issues that may occur. If no problem arises, then drink a cup of coffee and consider yourself "lucky". If the GPO is not yet tested and you are not sure whether it will havoc the Active D

PowerShell list processes by username

List all processes by username in PowerShell, requires that PowerShell to be run in elevated mode. List all running processes for all users:       Get-Process -IncludeUserName  | ft -AutoSize      ft - Autosize --will not truncate the output List all running processes and filter by UserName:   Get-Process -IncludeUserName  | Where UserName -EQ -EQ "This_User_Name"  | ft -AutoSize Above script will filter the output to the specified username. Get running word or winword process for the specified user and kill or stop the process. Get-Process winword -IncludeUserName  | Where UserName -EQ "This_User_Name"  | Stop-Process -Force -Force parameter will suppress the prompt whether to kill or stop the process, use sparingly in production environment Requires PS 4.0 version to run above commands. Cheers!! till next time. ================================ Free Android Apps: Click on links below to find out more: Linux Android App chea