Because Hello World! is necessary. 😌
echo "Hello World!"
To change into world
directory
cd ./world
Note: There are two types of path you may specify - relative and absolute. The path given here as an argument to cd is a relative path. Absolute paths start with a '
/
', the root of the Linux filesystem. An example would be/home/pulsar17/world
.
'.
' is an alias to the current directory.
List it all (in the current directory)
ls .
List and give me more info about the contents of current directory (-l
) but give me most recent files at the bottom (-tr
)
ls -ltr .
Rename DoctorWho2009.file
to DoctorWho2020.file
mv DoctorWho2009.file DoctorWho2020.file
Note: For it to work you need to be in the directory that contains DoctorWho2009.file. Also there is no
rename
command as such. Apart from renaming filesmv
is also used to move files as its name suggests.
Copy veryimportantfile.file
to evenmoreimportantfile.file
(Why do that? You might think that 'very' important things are also 'even more' important things. Prioritise 😌 (Imagine Stonks Man meme))
cp veryimportantfile.file evenmoreimportantfile.file
Create files and directories
- Touching is fine? 🤷♂️
touch thisisanewfile.txt
- The Directory Creator
mkdir thisisanewdir anotherdir yetanotherdir "A Single Dir"
To include spaces in an argument enclose the argument in double quotes " "
.
Note: Spaces in names of files and directories are not recommended. Use '
_
' or '-
' instead.
Remove files and directories
rm file_to_remove
Caution! rm
won't ask you whether you want to delete a file or not. Be extra careful with directories.
To remove a directory, type:
rm -rf dir_to_remove
Know your Local IP Address
ip a #You need to look for the IP Address as it outputs much more info
Know your Public IP Address
curl ifconfig.me ; echo
Help will be given to those who deserve need it.
man ls
man
presents a manual for the command given as argument. It is quite useful and a life-saver when not connected to internet.
Type
man man
Get acquainted with reading a man page.
Look for the various sections numbered 1,2,3, ...
Then look at the top left corner of the man page of any command.
Example - man(1)
Next part would be about files, users, permissions and introduction to pipes (|
) in Linux.