Dark
Owner
- Joined
- Mar 21, 2024
- Messages
- 25
Linux SysAdmin [RHEL] - Lesson #1
This thread is start of Linux System Administrator topic based on RedHat.
General Information and Terms:
Recursive - Changes affected by only existing components, new components will NOT be affected.
Default - Changes affected by only new components, existing components will NOT be affected.
[TAB] button - It is used to complete which we have partially typed commands or directories
| (Pipe) - It used for sending a command's output to other command's input.
Example:
ls | grep "a" - ls lists files/folders in current directory, grep filters and shows only files/folders including "a" letter.man command_name - shows document of command/tool. Example: man ls - it shows document of ls command. Basic Commands
1.
ls - Lists file/folders in current directory.
2.
pwd - Shows current directory location/path.
3.
cd - Changes directory, example: cd /usr/binAfter, checking with pwd command
4.
cat file_name.ext - Prints inside of file on terminal in plaintext
5.
tac file_name.ext - Prints reversed (starts from last line) inside of file on terminal in plaintext.
6.
rm file_name/folder_name - Removes file and folders.Best Practise:
rm -rf file_name/folder_name - Removes files/folders Recursively* (-r) and forced (-f)
7.
touch file_name.ext - Creates empty file.
8.
mkdir folder_name - Creates folder.Best Practise:
mkdir -p not_existing_folder/folder_name - Creates folder with parents (-p), it means creating not existing folder in directory too.If you do not use -p option, not_existing_folder/folder_name will be failed.
9.
mv - moves files/folders, more options to applyGeneral:
mv file_name.ext1 file_name.ext2 - renames (moves) file file_name.ext1 to file_name.ext2
9.1.
mv folder_name1 folder_name 2 - renames (moves) folder folder_name1 to folder_name2
9.2.
mv file_name.ext/folder_name /path/to/file_name.ext - moves file's current directory to /path/to folder
10.
cp - copies files/folders, more options to applyFor copying folder, must use with Recursive (-r/-R) option.
11.
grep "filter_word" - finds lines which includes given word.Best Practise:
command | grep "filter_word"
12.
wc - shows word count.1 (Line Count), 1(Word count), 6(byte size)
P.S> hello is 5 byte, but Linux adds \n (break line) end of the file, making it 6 byte total.
13.
head - shows first 10 lines.Best Practise:
head -n total_line_number
14.
tail - shows last 10 lines reversed.Best Practise:
tail -n total_line_number
15.
history - shows user's history.
15.1.
history -c - removes current user terminal session's command history, not all command history.
15.2.
history -w - writes current user terminal session's command history to ~/.bash-history
15.3.
history -c && history -w - deletes permanently user's command history.
15.4.
!command_number - executes history numbered command
Click to Go Linux SysAdmin [RHEL] - Lesson #2
Last edited: