Essential Linux Commands & File System Structure
Classified in Computers
Written at on English with a size of 7.16 KB.
Linux File System Structure: An archive of Linux is associated with 3 parts: superblock, inode table, and data blocks.
Network Ports: To see the ports assigned to services.
Display Active TCP/IP Connections: netstat -a
User Management:
- Create password:
passwd (user)
- Add user to group:
usermod -g group_name
- Disable:
60001
- Enable:
60002
Practical Commands:
Add User: adduser
- Change folder privileges:
chmod
- Check privileges:
ls -de
(see if you changed privileges)
- Create a user:
useradd newuser
passwd newuser
- Create a directory: The command
mkdir
is used to create directories:mkdir mydirectory
- Create a report:
ps -aux >> reporte.txt
- Directories associated with the user:
-d dirname
- Changing permission:
chmod 744 file.txt /file.txt
- Change owner:
chown
Entering as root:# chown [user] [folder] -R
- Render a file in a loop:
(File $i) touch (think file) for (i)
- Create a task in crontab:
(memory occupied by process memory space) $ [data]
- Archive files: The
tar
command does two things:- Package folders within a file
- Compress file
The
tar
command syntax:tar -zcvf archivo_nuevo.tar.gz dirname
Where:
-z
: Compress the file using gzip-c
: Create a file-v
: Verbose mode, displays progress-f
: Filename
Commands:
Processor type: arch
Calculator: bc
(use quit
to exit)
Calendar: cal
or cal [[month] year]
(e.g., cal 2003
)
View file contents: cat
Change attributes: chmod
Change file owner: chown
Go out of a directory: cd ..
Change directory: cd
Clear the screen: clear
Compare files: cmp
Compress files: compress
Compress files (keep original): compress -c
Decompress files: compress -d
Copy files: cp
Display the date: date
Report disk space: df
Disk usage summary: du
Text editor: ed
(starts in command mode, use i
for text mode)
Text editor: ex
Locate files: find
Display a witty quote: fortune
Free and used memory: free
Email summary: frm
Compress files: gzip
C compiler: gcc
C++ compiler: g++
Decompress files: gunzip
Output first lines of a file: head
Output first two lines: head -2
Print computer system name: hostname
User and group ID: id
Terminate a process: kill
Forcefully terminate a process: kill -9
(see ps
)
Past users logged in: last
List files and directories: ls
List all entries: ls -all
Reverse order list: ls -r
List in columns: ls -c
Logout: logout
Login: login
Create a shortcut: ln -s
Email: e-mail
Command manual: man
Display info page by page: more
(exit with q
)
Batch file editing: sed
(e.g., sed -n '500,600p' archivote
)
Create a directory: mkdir
Display a file one screen at a time: more
Rename: mv
Mount CD-ROM: mount /dev/cdrom /mnt/cdrom
Mount floppy (msdos): mount /dev/fd0 -t msdos /mnt/fd0
Mount hard drive (FAT32): mount /dev/hda1 -t vfat /mnt/hda1
Mount hard drive (NTFS): mount /dev/hdb1 -t ntfs /mnt/hdb1
Mount zip disk: mount /dev/sda1 /mnt/sda1
Change password: passwd
Determine process number: ps
(see kill
)
Current directory: pwd
Delete files: rm
Remove directories: rmdir
Create empty file or update date: touch
Kill X applications: xkill
Unmount disks or drives: umount
Unmount CD-ROM: umount /dev/cdrom
Text editor: vi
Count lines, words, characters: wc
Who is in the system: who
Write to another user: write