commands miscellanea
the ps command, |
which shows the status of running processes |
vimtutor |
tutorial for vim |
rmdir |
erases directory |
whoami |
tells what kind of user you are |
passwd |
set up password or change the one you have |
xemacs ".bashrc" |
calls text editor |
cat |
scan docs. from conCATenate |
ln |
let you make links between files |
stty "funtion key" |
lets you set up the function keys |
stty -a |
show the current function key |
stty sane |
fix the shell |
ls ["range"].["range"] |
looks for combinations that satisfy specification |
tail -"#" |
displays the last # of lines of a text file |
head -"#" |
displays the first #of lines of a text file |
less |
show less of a text file |
awk |
organize data in in columns and rows |
sort |
sort lines of text files |
clear |
cleans the screen |
man |
manual |
du |
estimates the file memory usage |
free |
displays the amount of free and used memory in the system |
df |
report file system disk space usage |
lsblk |
command used to report info about block devices as follows |
fdisk |
manipulate disk partion table |
uname |
print system info |
cat /proc/cpuinfo |
cpu info |
lscpu |
cpu info |
sudo |
gets root authority |
grep |
search for a string in a file |
tar |
creates, view or extracts from archive |
find |
find files with a pattern |
ssh |
remotely login |
awk |
controls output |
gzip |
creates a *.gz compressed file |
shutdow |
turn off the machine |
kill |
terminates a process |
mount |
it mounts file |
ifconfig |
view the newtwork interrface |
whereis |
find the address of a specific command |
uptime |
show the running time of the system |
hostname |
displays the system hostname |
cal |
show the month calender |
bg |
sends a process to the background |
df |
shows file system disk space |
diff |
serves to find differences between to files |
lspci |
serves to visualize P.C.I. devices |
top |
used to manage top processes |
ping host |
send echo message to the host |
dig domain |
show the dns specification for the domain |
scp |
allows to remotely copy files from one machine to another machine |
ip addr |
shows ip address and related information |
expr |
allows to perform some mathematical operations |
env |
permit to see the current environment variables |
history |
shows the last one hundred commands execute in the system |
iwlist |
displays wireless devices plus configuration files |
locate |
find files by name |
lshw |
display some basic information about the machine |
lsusb |
display information about usb |
nice |
nice - run a program with modified scheduling priority |
pidof |
find the process ID of a running program. |
split |
serves to split large files in to smaller ones |
sum |
checksum and count the blocks in a file |
watch |
execute a program periodically, showing output fullscreen |
setting NFS tutorial
sudo yum install nfs-utils nfs-utils-lib |
install NFS |
sudo systemctl enable rpcbind; $ sudo systemctl start rpcbind; $ sudo systemctl enable nfs-server; $ sudo systemctl start nfs-server; $ sudo systemctl start nfs-lock; $ sudo systemctl start nfs-idmap |
commands to start the service in charge of the service's functionality |
$ sudo mkdir /NFSsharedFolder; $ sudo chmod –R 0755 /NFSsharedFolder |
commands to create and prepared a folder |
$ sudo nano /etc/export |
open nano to modify the export file |
/NFSsharedFolder 172.25.0.0/16(rw,sync,no_root_squash,no_all_squash) |
add this line to the export line |
$ sudo systemctl restart nfs-server |
restart the NFS server |
$ sudo firewall-cmd --permanent --add-port=111/tcp; $ sudo firewall-cmd --permanent --add-port=875/tcp; $ sudo firewall-cmd --permanent --add-port=2049/tcp; $ sudo firewall-cmd --permanent --add-port=20048/tcp; $ sudo firewall-cmd --permanent --add-port=42955/tcp; $ sudo firewall-cmd --permanent --add-port=46666/tcp; $ sudo firewall-cmd --permanent --add-port=54302/tcp; $ sudo firewall-cmd --reload |
commands to open and configure appropriate ports |
move to the client |
to continue the configuration |
$ sudo yum install nfs-utils nfs-utils-lib |
also need to install nfs in the client side of the relationship |
$ sudo systemctl enable rpcbind $ sudo systemctl start rpcbind $ sudo systemctl enable nfs-server $ sudo systemctl start nfs-server $ sudo systemctl start nfs-lock $ sudo systemctl start nfs-idma |
commands to start appropiate services |
$ sudo mkdir /NFSfolder $ sudo chmod –R 755 /NFSfolder |
create and set up share folder |
$ sudo nano /etc/fstab |
open nano to edit fstab folder |
172.25.22.10:/NFSsharedFolder/ /NFSfolder/ nfs4 defaults 0 0 |
add this line to the fstab folder |
$ sudo mount |
use this command to check what was mounted in the specified NFS server |
|
|
File modification
chown USER FILE |
changes the user ownership of a file to the specified user |
chown USER: FILE |
changes the user and the group to the specified user |
chown USER:GROUP FILE |
changes the user, and group ownership of the file to the specified user and group respectively |
chown :GROUP FILE |
changes the group ownership of the file to the specified group |
chgrp GROUP FILE |
changes the group ownership of the file to the specified group |
chmod [0,1,2,4,7][0,1,2,4,7][0,1,2,4,7] |
changes readability, writability, and executability of a file to owner, group owner, and everyone respectively |
chmod [u(user),g(group),o(others), a(all)][+,-][r(read),w(write),x(execute),t(write to not delete)] File |
adds or removes permission to r,w,x from u,g,o or a |
tutorial on how to setup Samba
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup |
creates backup file in case you mess it up |
sudo mkdir /SharedFolder/ |
create folder to be shared |
$ sudo chmod -R 755 /SharedFolder/ |
set right permissions |
$ sudo firewall-cmd --permanent --zone=public --add-service=samba |
set firewall |
$ sudo firewall-cmd --reload |
set firewall |
$ sudo nano /etc/samba/smb.conf |
open nano to start the file configuration |
follow instruction in comment |
then come back to this line and keep inputting the commands |
$ sudo smbpasswd –a user1 |
set up password for user1 |
$ sudo systemctl enable smb.service; $ sudo systemctl enable nmb.service; $ sudo systemctl start smb.service; $ sudo systemctl start nmb.service |
commands to enter testing phase |
Move to the client side |
and continue |
smb://server_ip_address |
type in the server connection screen |
the configuration file should look like this:
[Shared Folder]
path = /SharedFolder
read only = no
guest ok = yes
browsable =yes
writable = yes
create mask = 0755
directory mask = 0755
workgroup = WORKGROUP
then save and create user1.
user and groups creations and modificaiton
groupadd GROUP |
creates new group |
groupmod -n NewGroupName |
changes the group name |
useradd USER |
creates new user |
useradd -d /path/to/home/dir/ |
creates a user with specified home directory |
useradd -u USERID USER |
allows to create user with personalized ID |
useradd -G GROUP1, GROUP2... USER |
allows to create user with multiples groups |
cat /etc/passwd |
lists all user and displays relevant information |
|
|
most used commands
pwd |
outputs the present working directory |
sudo + other command(s) |
allows to gain root privileges |
root |
access root user and its privileges |
cd + specific address |
access a specific address |
cd |
move to home directory |
cd .. |
go back to parent directory |
ls |
outputs information of present directory |
ls + specific address |
shows files in the specific directory |
ls -a |
option a allows to show hidden files |
ls -l |
show deeper description of showed files |
ls -h |
shows files in human readable format |
touch "fileName" |
creates file with the specified fileName |
echo > "insert desired text" |
allows to write text to a file(if any, erase old text in file) |
echo >> "insert text here" |
allows to append text to a file |
cp "file" "directory" |
copy files to new address |
mv "file" "directory" |
cut files to new address |
mkdir "name" |
creates a new directory inside the present directory |
mkdir /path/to/directory/"name" |
creates directory with a specific path |
rm "file" |
removes files from the system |
rm -r "directory" |
removes recursively the specified directory from the system |
service related commands
journalctl |
prompts the user with the active services in the system |
systemctl |
Control the systemd system and service manager |
|
|
commands miscellanea 2
flock |
manage locks from shell scripts |
lockf |
apply, test or remove a POSIX lock on an open file |
fcntl |
manipulate file descriptor |
statd |
NSM service daemon |
stat |
display file or file system status |
samba |
A Windows AD and SMB/CIFS fileserver for UNIX |
smbpasswd |
The Samba encrypted password file |
sssd |
System Security Services Daemon |
setgid |
set group identity |
mktemp |
create a temporary file or directory |
true |
do nothing, successfully |
false |
do nothing, unsuccessfully |
if |
"use" a Perl module if a condition holds |
test |
check file types and compare values |
exit |
self explanatory |
w |
displays who is logged in and what are they doing |
fg |
brings the most recent background job to the foreground |
sleep |
delay for a specified amount of time |
tac |
concatenate and print files in reverse |
wall |
write a message to all users |
whatis |
display basic information about a command passed as parameter |
yes "string" |
infinitely outputs a string pass as parameter to the command |
|