Post

Linux Journey - 01 Command Line PART 2

Linux Journey - 01 Command Line PART 2

Linux Journey

01. Command Line Part 2

Important:

My goal here is to fully understand what I am doing with Linux. Over the years I noticed that I learn best, if I document it and try to explain it to myself in different words. I know that the webpage https://linuxjourney.com/ is already written for beginners never the less I want to rephrase, document and repeat the commands here.

My summary may not be complete so I would recomment you that you actually learn Linux from https://linuxjourney.com/ yourself :-)

1.11 mv (Move)

This command moves files and renames them if wanted. Similar to cp in terms of flags and function.

$ mv oldfile newfile

Also rename directories:

$ mv directory1 directory2

1.12 mkdir (make directory)

We had with touch the command for creating files. Now we want to create directories with mkdir.

Creating multiple folders. mkdir folder1 folder 2

Also possible to create subdirectories with the -p (parent flag)

mkdir -p folder1/folder2/folder3

This would create all folders, which not exist.

1.13 rm (Remove)

We can create files and directories, now we need a command for remove them. With rm we just delete the specified folders/files.

rm file1.

Be careful here with this command. There is no trash can, where we can recover the deleted files.

For write protected files we can use -f (force)

rm -f file1

Again with flag -i you get a prompt. (Interactive)

For remove all files and subdirectories it may have, we can use the flag -r for recursive.

For directories we use rmdir folder1. Same flags as with rm

1.14 find

We need a search here, after creating and deleting so many files and folders. With find we can search for files.

1
$find /home -name "Test1.txt" 

We specify the folder first and then with -name we search for the file.

With the flag -type we can also search for folders. (d)

1.15 help

If you dont know which flags you use for a command, you can use --help behind the command.

ssh --help

1.16 man

And if you need more information than with ` –help then you can use man` for “manual”. There are all flags and nessecary informations about the command.

man ssh

1.17 whatis

If you have no idea, what this command does, you can ask it with whatis what it does.

whatis ssh

1.18 alias

Cou can create an alias for commands you need more often.

alias check = "ls -la"

Now ls -la can be used when you type check. After reboot the alias will be gone. To add a permanent alias you have to add the alias in the ~/.bashrc .

If you dont like your alias anymore in the same session you can just use unalias.

1.19 exit

With exit we can exit the shell here. We can also use the logout command.

This post is licensed under CC BY 4.0 by the author.