2. LIST...
● ls [options] [file|directory]
●
●
-l
will output the files and directories in long list
format.
-s, --size
print the size of each file, in blocks
-S sort by file size
-a, --all
do not ignore entries starting with .
4. ● ls list all files
● ls -l list all files with details
● ls *.gif list gif files
● ls *.gif -l list gif files with details
● ls | wc -l count all files
● ls *.gif | ws -l count gif files
● (wc = word count)
5. COPY...
● cp [OPTION]... SOURCE DEST
● cp
is the Linux copy command, this shell
command is used to copy files|directories from
one location on the filesystem to another.
6. options.
● -f, --force
● if an existing destination file cannot be
opened, remove it and try again
● -i, --interactive
● prompt before overwrite
● -R, -r, --recursive
● copy directories recursively
7. ● cp *.txt text
● It will copy all files ending in .txt into the text
directory.
●
To copy a file to your home directory:
cp /usr/local/doc/ue.txt $HOME
This copies the file ue.txt to your home directory
8. ● To copy a file to the parent directory:
● cp mail.txt ..
● This copies the file mail.txt to the directory
immediately above the current working
directory.
9. -f, --force if an existing destination file cannot be opened,
remove it and try again
• -i, --interactive prompt before overwrite
• -l, --link link files instead of copying.
• -p same as --preserve=mode,ownership,timestamps
• -R, -r, --recursive copy directories recursively
• -s, --symbolic-link make symbolic links instead of copying
• -u, --update copy only when the SOURCE file is newer than
the destination file or when the destination file is missing
• -v, --verbose explain what is being done
10. MOVE....
● mv [OPTION]... [-T] SOURCE DEST
● the Linux terminal command to move files|
directories. Like the cp command, but deletes
the original source.
11. REMOVE...
● rm -f [file]
● option is if you are wanting to force a file to
be removed
● rm -r files
● (recursive remove) Remove files,
directories, and their subdirectories
12. TOUCH....
● arul@arul-desktop:~/Desktop$ ls
● Home.desktop ShellIntro.pdf su
trash.desktop
● arul@arul-desktop:~/Desktop$ touch new
new1 new2
● arul@arul-desktop:~/Desktop$ ls
● abc Home.desktop new new1 new2
ShellIntro.pdf su trash.desktop zxc
13. CAT...
● The Linux cat command is the Unix command
to list a file’s contents onto your screen, or pass
via pipeline to use with other Linux commands.
The cat command comes from the word
concatenate.
14. ● arul@arul-desktop:~/Desktop$ cat new
● arul@arul-desktop:~/Desktop$ vim new
● arul@arul-desktop:~/Desktop$ cat new
● sure
● arul
● shrini
15. mkdir
● The Linux command mkdir is used to make
directories in Linux.
● mkdir - make directories
●
16. Example
● arul@arul-desktop:~/Desktop$ ls
● abc Home.desktop new new1 new2
ShellIntro.pdf su trash.desktop zxc
● arul@arul-desktop:~/Desktop$ mkdir comm
● arul@arul-desktop:~/Desktop$ ls
● abc comm Home.desktop new new1
new2 ShellIntro.pdf su trash.desktop zxc
17. grep
grep [OPTIONS] PATTERN [FILE...]
● The Linux grep command is used to extract
lines of data from files
●
arul@arul-desktop:~/Desktop$ grep sure new
sure
arul@arul-desktop:~/Desktop$ grep s new
sure
shrini
18. WORD COUNT...
● wc counts the characters,lines,words in a file.
● Options:
● -c output char., count
● -l output lines count
● -w output words count
19. Example
● wc -w linux.txt
● 34
● Display the word count for linux.txt
● Defult: -clw
20. WHO AM I
● Find which user is loged
shrinivasan@shrinivasan-laptop:~$ whoami
shrinivasan
21. DATE
● For display the today's date.
● Date prints the systems time and date.
● shrinivasan@shrinivasan-laptop:~$ date
● Sun Oct 18 13:46:29 IST 2009
22. CALENDAR..
● Cal prints an ASCII calendar of the current
month.
● Cal display the calendar
● shrinivasan@shrinivasan-laptop:~$ cal
October 2009
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
24. At command
● shrinivasan@shrinivasan-laptop:~$ at 13:57
● warning: commands will be executed using /bin/
sh
● at> echo "hello" > hai
● at> <EOT>
shrinivasan@shrinivasan-laptop:~$ touch hai
●
shrinivasan@shrinivasan-laptop:~$ cat hai
hello
25. Ps
● ps - report a snapshot of the current processes
● To see every process on the system using BSD
syntax:
● ps -ax
● ps -axu