Relative path : short path to the required/specified destination
Example : ls -al tmp
Absolute path : The full path for the required/specified destination
Example : ls -al /home/user/tmp
list only the directories,with out listing the files in it:
[user@tcox1 ~]$ ls -d tmp
tmp/
now,we will talk about the special directory called the
reference directory.
[user@tcox1 ~]$ ls -d
.
. is the
reference for my current directory.
Direct to the home directory:
cd ~ this will take to my home directory
How can i get the environment variable?
[user@tcox1 etc]$ echo $HOME
/home/user
for example:
[ec2-user@tcox1 etc]$ echo $HOME
/home/ec2-user
[user@tcox1 etc]$ echo "this is a test" > my text.txt
[user@tcox1 etc]$ file my text.txt
my text.txt: ASCII text
it helps us to determine,what kind of files it was.(I mean
it is a binary file or any other file type).
Globbing:
globbing means,it’s a wild card or a list of operator,that
matches the one or more file.
Based on a defined or indicated path.
For example:
literally is a wild card,that matches anything in that
directory.
But I can specify,what kind of file I want.
If I want to list the files in the /etc.
[user@tcox1 ~]$ ls -al /etc/c*
xxxxxxxxxxxxxxxxxxxxxxxx 2016 /etc/cetnos-release
xxxxxxxxxxxxxxxxxxxxxxxx 2016 /etc/cgconfig.conf
so,I can see globbing and more around and see things.
[user@tcox1 ~]$ ls -al /usr/bin/*s????.?h
xxxxxxxxxxxxxxxxxxxxxx 2014 /usr/bin/lesspipe.sh
Any number of characters before the letter s -----> *
Give me a single character before the letter h ------> ?
Any number of characters before the letter s -----> *
Give me a single character before the letter h ------> ?
how,you want,if you want to see the range of staff?
[user@tcox1 ~]$ ls -al /usr/bin/[a-n]*.sh
xxxxxxxxxxxxxxxxxxxxxx 2014 /usr/bin/lesspipe.sh
Touch command importance:
If you did not create the file,the touch command will create
the file for you.
If the file exists,it updates the time and date.
we can use globbing to touch multiple files.
speaking about the file properties:
it specify the file and file system stats.
stat -f test.txt
File: "test.txt"
ID: ca0100000000 Namelen: 255 Type: xfs
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 2094336 Free: 906341 Available: 906341
Inodes: Total: 4193792 Free: 3950023
Note:
For copy command,it is always recommened to provide the
absolute path.
Inorder to copy the directory,we have to use the –r,which
means the recursive.
About redirecting directly to the home directory and its related sub-directory:
for example your in ec2-user and you want to home directory of the ec2-user:
[ec2-user@tcox1 ~]$ cd ~
/home/ec2-user
Example:
Example for creating multiple directories at a time:
for example your in ec2-user and you want to home directory of the ec2-user:
[ec2-user@tcox1 ~]$ cd ~
/home/ec2-user
Example:
test:root~ # pwd
/root
test:root~ # cd ~kk
test:root/home/kk # pwd
/home/kk
Example for creating multiple directories at a time:
test:root~ # mkdir mkdir1/test1/test2/test3
mkdir: cannot create directory ‘mkdir1/test1/test2/test3’: No such file or directory
Ingeneral,the directory is created one at a time.
We can create multiple directories in following way:
test:root~ # mkdir -p mkdir1/test1/test2
test:root~ # pwd
/root
test:root~ # ls -la | grep mkdir1
drwxr-xr-x. 3 root root 19 Aug 17 15:38 mkdir1
test:root~/mkdir1/test1/test2 # pwd
/root/mkdir1/test1/test2
No comments:
Post a Comment