Linux Unix - GRU File Commands
Linux Unix - GRU File Commands
Linux Unix - GRU File Commands
what -- does
Use -- to separate options from parameters.
for example
Rm -- -galondel.png
─(root 💀 kalillocal)-[~/Downloads/lolapi]
└─# pwd
/root/Downloads
ls - local dictionary
exa
─(root 💀 kalillocal)-[~/Downloads/lolapi]
─# ls -a
. .. .lal.txt lal.txt
file permissions, number of links, owner name, owner group, file size,
timestamp of last modification, and file/directory name.
for example
file permissions number of links owner name owner group file size
timestamp of last modification
Directory name
Desktop
┌──(root💀kalillocal)-[~/Downloads/laloli]
└─# ls -t
indo.txt lal.txt
Mar 9 12:26 Mar 9 11:40
TOUCH
you can create a file with it.
—# touch command on existing file will update the
timestamp.
after touch .lal.txt
File command
shown the format / kind of file.
$ file banana.jpg
┌──(root💀kalillocal)-[~/Downloads/laloli]
└─# file banana.jpg
banana.jpg: directory
its dictionary not jpg file its not like in windows file sys
more
more to see contact of file text
less
less to see contact with extended options
-------------------------- global—---------------
file1 | grep ?$
this line ends with ? mark ?
this line does not end with ? Mark !
file1 | grep d[iou]g
would match: dig, dog, dug
Alias
alias to change recognition of command fo ex:
alias foobar='ls -la' to call (ls -la) command as “foobar”
● 4: read permission
● 2: write permission
● 1: execute permission
Rm remove
rm -r remove directory and the stuff within it
rm -d remove empty directories
rm -f force remove
Manipulating files
std
echo to display input on terminal
now we use >
cut command
cat talmat.txt
hello
for example
cut -c 2 talmat.txt
- a
explain:
cut -c [index] allow us to
display key by index number
User Management
display list of users
cat /etc/passwd
let's explain this
root:x:0:0:root:/root:/bin/bash
1. Username
2. :encrypted User's password You can see many different symbols that
are in this field, if you see an "x" that means the password is stored in
the /etc/shadow file, a "*" means the user doesn't have login access
and if there is a blank field that means the user doesn't have a
password.
3. user id (uid)
4. group id
5. GECOS field - This is used to generally leave comments about the
user or account
6. User's home directory
7. User's shell - you'll probably see a lot of user's defaulting to
bash for their shell
1. Username
2. Encrypted password
3. Date of last password changed - expressed as the number of days
since Jan 1, 1970. If there is a 0 that means the user should change
their password the next time they login
4. Minimum password age - Days that a user will have to wait before
being able to change their password again
5. Maximum password age - Maximum number of days before a user
has to change their password
6. Password warning period - Number of days before a password is
going to expire
7. Password inactivity period - Number of days after a password has
expired to allow login with their password
8. Account expiration date - date that user will not be able to login
9. Reserved field for future use
cat /etc/group
1. Group name
2. Group password - there isn't a need to set a group password, using an
elevated privilege like sudo is standard. A "*" will be put in place as
the default value.
3. Group ID (GID)
4. List of users - you can manually specify users you want in a specific
group
User Management Tools
useradd bob
add new user and creating entry in /etc/passwd
sets up default group and adds an entry to the /etc/shadow
Removing Users
userdel bob
Changing Passwords
passwd bob
VI .
the vi is our tool for editing files