The ls command lists the contents of a directory.The default is the current directory. You may think it is a simple command command that has very little usage.But you are wrong. There are many options for ls command.
ls -l for a detailed (long) listing
ls -F to display file type information (for more on file types and the permissions).
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
cp copies the contents of file1 to file2 or it copies all files to directory:
cp file1 file2
cp file1 … fileN dir
Note: A symbolic link is a special file that points to another file or directory, which is called the target. Once created, a symbolic link can be used in place of the target file name.
Follow Symbolic links means if we copy a directory that has a shortcut or symbolic link, then if we don’t specify -L, then the symbolic links won’t be updated as per the new location.
mv renames file1 to file2. In the second form, it moves all files to the directory:
mv file1 file2
mv file1 … fileN dir
The touch command creates a file. If the file already exists, touch does not change it, but it does update the timestamp.
To delete (remove) a file, use rm. After you remov e a file, it’s gone. Do not expect to be able to “undelete”anything.
The echo command prints its arguments to the standard output:
echo Hello there.
The cd command changes the shell’s current working directory to a given directory.If you omit dir, the shell returns to your home directory.
The mkdir command creates a new directory.
The rmdir command removes the directory.
The shell is capable of matching simple patterns with files in the current working directory.
The simplest of these is the star character (*), which means match any number of arbitrary characters.
Prints a list of files in the current directory.
Matches all files starting with at;
Matches files that end with at.
Matches any files that contains at.
Match exactly one arbitrary character.
Matches boat and brat.
prints the lines from a file or input stream that match an expression.
grep Hello /etc/test.txt
Print the lines in the file /etc/test.txt that contain the text Hello
grep Hello /etc/*
To check on every file in /etc that contains root, you could use this
CONTROL-D on a line by itself stops the current standard input entry (and often terminates a program).
CONTROL-C terminates a program regardless of its input or output.
CONTROL-Z stops a program, but doesn’t terminate it.