sed (stream editor)
Sed is a non-interactive editor. Instead of altering a file by moving the cursor on the screen, you use a script of editing instructions to sed, plus the name of the file to edit. You can also describe sed as a filter.
Let’s have a look at some examples:
[...]
1.) stdout to a file
The output of a command will redirect to another file.
Eg: ls -l > list.txt
2.) stderr to a file
The following command will redirect the stderr ouput of a program to a new file.
Eg: grep sibu * 2> grep-errors.txt
Here, a file called ‘grep-errors.txt’ will be created and it will contain what you [...]
History with Time and Date
The command history will give you the list of command which you executed earlier. By default you won’t get the the command execution time and date.
If you wish to have a history details with time and date please do the following.
Open /etc/bashrc file and add the following line.
Export HISTTIMEFORMAT=”%h%d [...]
Zombie process is an inactive computer process, according to wikipedia article, “…On Unix operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table, allowing the process that started it to read its exit status. In the term’s colorful metaphor, the child [...]
YUM packages updater (Fedora, RedHat and like)
yum install package_name download and install a rpm package
yum localinstall package_name.rpm That will install an RPM, and try to resolve all the dependencies for you using your repositories.
yum update update all rpm packages installed on the system
yum update package_name upgrade a rpm package
yum remove package_name remove a rpm [...]
rpm -ivh package.rpm install a rpm package
rpm -ivh –nodeps package.rpm install a rpm package ignoring dependencies requests
rpm -U package.rpm upgrade a rpm package without changing configuration files
rpm -F package.rpm upgrade a rpm package only if it is already installed
rpm -e package_name.rpm remove a rpm package
rpm -qa show all rpm packages installed on the system
rpm [...]
find / -name file1 - search file and directory into root filesystem from ‘/’
find / -user user1 - search files and directories belonging to ‘user1′
find /home/user1 -name \*.bin - search files with ‘. bin’ extension within directory ‘/ home/user1′
find /usr/bin -type f -atime +100 - search binary files are not used in the last [...]
Users and Groups
groupadd group_name create a new group
groupdel group_name delete a group
groupmod -n new_group_name old_group_name rename a group
useradd -c “Name Surname ” -g admin -d /home/user1 -s /bin/bash user1 create a new user belongs “admin” group
useradd user1 create a new user
userdel -r user1 delete a user ( ‘-r’ eliminates home directory)
usermod -c “User FTP” -g [...]
Hard Links :
1. All Links have same inode number.
2.ls -l command shows all the links with the link column(Second) shows No. of links.
3. Links have actual file contents
4.Removing any link ,just reduces the link count , but doesn’t affect other links.
Soft Links(Symbolic Links) :
1.Links have different inode numbers.
2. ls -l command shows all links with [...]
fsck is used to check and optionally repair one or more Linux file systems. All you need to do is just create empty file /forcefsck.
#touch /forcefsck
By creating /forcefsck file you will force the Linux system to perform a full file system check.