Basic commands
Linux : Ubuntu
How to make directory
Syntax :
• mkdir dirctoryname
How to create hidden files
• By using . Before the file or directory.
• ls –a command is used to show hidden files/directories.
ls -l
• Long list
ls -al
• ‘a’ denote hidden , ‘l’ denote long list.
Create directory into
directory
Change directory
• cd .. (to shift one level above the current directory)
• cd ~ ( to go to the previous directory) /(`~` this
argument is used in `cd` command to change the
directory to the home directory from any location in Linux
System.)
• cd / ( to go to the root directory ,as we input / argument)
• cd ( we do not provide any arguments to the cd command
to go to the home directory)
Copy command
Cut and paste command
Rename
Remove
• To remove (or delete )a file in linux from the command line, you
can use rm ,shred, or unlink commands.
• The unlink command allows you to remove only a single file,
while with rm and shred, you can remove multiple files at once.
•
Remove file
• rm file name (to remove a file)
• rm file1 file2 file3 (remove multiple files)
• rm * filename of specific format (rm * .pdf)
• Use the rm with the -i option to confirm each file before
deleting it:
• rm -i filename(s)
rm command
By default, when used without any option, rm
cannot remove directories.
To remove an empty directory, with rm, invoke the
command with the -d option:
Remove directory
To remove non-empty directories and all the files within
them, use the rm command with the-r (recursive) option:
• rm -r dirname
Remove
To remove non-empty directories and all the files
without being prompted, use rm with the -r
(recursive) and -f options:
Link
• https
://linuxize.com/post/how-to-remove-files-and-directories-us
ing-linux-command-line
/
• https://www.geeksforgeeks.org/man-command-in-linux-wit
h-examples/
man command
man command in Linux is used to display the user manual of
any command that we can run on the terminal.
• man command name
Head Command
• The 'head' command displays the starting content of a file.
By default, it displays starting 10 lines of any file.
Syntax: head <file name>
To print specific lines use “-n”
for Example : head –n 2 filename