Thursday, July 4, 2013

Linux Commands

Create directory and give permisson in a go.
# mkdir /tmp/test1 -v -m 1777

Environment variable $CDPATH
It lets you define some path to look for when moving with cd command.
# export CDPATH = . : / : ~/
# cd usr
/usr
# cd Desktop
/home/viku/Desktop

Hardware info:
# dmidecode --type memory
# dmidecode --type bios
# dmidecode --type cache
# dmidecode --type processor
so on....

Find all files with extension .txt or .jpg
#find . -type f -inode "*.txt." -or -inode "*.jpg"

Find all files except hidden files
#find . -type f -inode "*.txt." ! ".*"


Append text at end of file, use >> operator.
Append text at beginning of file.
#echo "text" |cat - file.txt > /tmp/out && mv /tmp/out file.txt

Check whether an alias is assigned to a command
#type ls

Revert alias to original
#unalias ls

Restrict alias effect and see the native command.
# command ls
# \ls
# "ls"

Diff and Patch
#diff -c oldfile newfile  > temp.patch
#patch < temp.patch


No comments:

Post a Comment