- $date
Date command is used to display
date date and time
-$date +%m
Displays only month
-$date +%h
Displays only month in word
-$date +%d
Displays only date
-$date +%y
Displays only year
-$date +%H/M/S
Displays Hours/Minutes/Seconds
- $man
Displays manual for commands
- $cal
Displays the current month calendar
- $who
Displays the List of users
currently logged in
- $who am i
Displays the user’s own logged in
details
- $echo
Displays given arguments
- $bc
Provide calculator facilities
- $passwd
Used to change current password of
the user
- $uname
Displays configuration of the
system
-r Displays the version of the OS
-s Displays the name of the OS
- $pwd
Stands for Present Working
Directory and displays know current working directory.
11. mkdir - make
directories
mkdir
[OPTION] DIRECTORY
Options
Create
the DIRECTORY(ies), if they do not already exist.
-m, mode=MODE set permission mode (as in chmod), not rwxrwxrwx - umask
-p, parents no error if existing, make parent directories as needed
-v, verbose print a message for each created directory
-help display this help and exit
-version output version information and exit
cd - change directories
Use cd to change directories. Type cd followed by the name of a directory to access that directory.Keep in mind that you are always in a directory and can navigate to directories hierarchically above or below.
mv- change the name of a directory
Type mv followed by the current name of a directory and the new name of the directory.
Ex: mv testdir newnamedir
pwd - print working directory
will show you the full path to the directory you are currently in. This is very handy to use, especially when performing some of the other commands on this page
rmdir - Remove an existing directory
rm -r
chmod - change file access permissions
Usage
chmod [-r] permissions filenames
r Change the permission on files that are in the subdirectories of the directory that you are currently in. permission Specifies the rights that are being granted. Below is the different rights that you can grant in an alpha numeric format.filenames File or directory that you are associating the rights with Permissions
u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.
Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
ls - Short listing of directory contents
-a list hidden files
-d list the name of the current directory
-F show directories with a trailing '/'
executable files with a trailing '*'
-g show group ownership of file in long listing
-i print the inode number of each file
-l long listing giving details about files and directories
-R list all subdirectories encountered
-t sort by time modified instead of name
cp - Copy files
cp myfile yourfile
Copy the files "myfile" to the file "yourfile" in the current working directory. This command will create the file "yourfile" if it doesn't exist. It will normally overwrite it without warning if it exists.
cp -i myfile yourfile
With the "-i" option, if the file "yourfile" exists, you will be prompted before it is overwritten.
cp -i /data/myfile
Copy the file "/data/myfile" to the current working directory and name it "myfile". Prompt before overwriting the file.
cp -dpr srcdir destdir
Copy all files from the directory "srcdir" to the directory "destdir" preserving links (-poption), file attributes (-p option), and copy recursively (-r option). With these options, a directory and all it contents can be copied to another dir
ln - Creates a symbolic link to a file.
ln -s test symlink
Creates a symbolic link named symlink that points to the file test Typing "ls -i test symlink" will show the two files are different with different inodes. Typing "ls -l test symlink" will show that symlink points to the file test.
locate - A fast database driven file locator.
more - Allows file contents or piped output to be sent to the screen one page at a time
cat - Sends file contents to standard output. This is a way to list the contents of short files to the screen. It works well with piping.
wc
- Print
byte, word, and line counts
cat files - Prints the
contents of the specified files.
cmp file1 file2 - Compares two files,
reporting all discrepancies. Similar to the diff command, though the output
format differs.
diff file1 file2 - Compares two
files, reporting all discrepancies. Similar to the cmp command, though the
output format differs.
$comm – Displays
output in three columns 1st column contains lines unique to the 1st
file, 2nd column contains lines unique to the 2nd file
and 3rd column displays lines common in both files.
$cut - Used to
extract specific columns from the particular file.
$cut
–c [COLUMNS-COLUMNS] file
$paste - Used to
combine 2 files output vertically
$uniq – Require
sorted file as an input and displays one copy of each line
-u select only those lines that are
not repeated
-d displays only one copy of repeated
line
-c displays frequency of occurrence of
all lines
$head – Displays
the starting ten lines of the file
-n displays top n lines
$tail – Displays
the ending ten lines of the file
-n displays n bottom lines
$tr – Translate
character in line with specific character
-s compressing multiple sequential
characters
-c complementing values expression
$grep – Searches
for particular pattern in files
-i ignoring case
-n displays line number that contains
pattern
-c displays only number of lines that
contains pattern
-l displays only name of the files
containing pattern
-v returns line that do not match with
pattern