find . -mindepth 1 -maxdepth 1 -not -empty -type d
source: https://stackoverflow.com/questions/815668/how-to-list-non-empty-subdirectories-on-linux#comment625237_8156...
Monday, January 20, 2020
Tuesday, August 13, 2019
tar excluding some files
tar -pczf MyFile.tar.gz /home/user/myDirectory/ --exclude=pattern
Example:
Excluding files whose names end in '.txt'.
tar -pczf MyFile.tar.gz /home/user/myDirectory/ --exclude='*.tx...
Friday, June 21, 2019
tar excluding directories
tar -pczf MyFile.tar.gz /home/user/myDirectory/ --exclude="./directoryToExclude1" --exclude="./directoryToExclude2"
Note that there is no "/" at the end of the path to the directory to exclu...
Wednesday, July 25, 2018
Swap columns in text file with awk
To swap column 2 and 3 in a 4 column file:
awk -F, '{print $1,$3,$2,$4}' OFS=; "FILE" > NEW_FILE
where:
OFS: indicates the separator character(';' in the example above).
FILE: original file.
NEW_FILE: new file with the chang...
Friday, April 27, 2018
Shell Script 'action' Command
'action' is defined inside a library called functions. You have to source your script first with this library in order to use it. This library is a distro distribution dependent and none of these distro libraries are compatible with the others. In Ubuntu is /lib/lsb/init-functions, SuSE has /etc/rc.status and in Centos is /etc/rc.d/init.d/functions. Some distributions don't use it at all.
Example...
Wednesday, April 25, 2018
Set or Change System Hostname
This will return the current hostname
$ hostname
MyHostame
To set hostname immediately:
$ hostname [MY_HOSTNAME]
This will change the hostname of your system immediately, but the original hostname will be restored upon next reboot. To set hostname to be permant follow the instructions below.
For systemd based distributions(newer version of different Linux distributions such as latest Ubuntu, Debian,...
Thursday, March 1, 2018
shmget errno 22 EINVAL: "Invalid Argument"
The man page says:
EINVAL A new segment was to be created and size < SHMMIN or size > SHMMAX, or no new segment was to be created, a segment with given key existed, but size is greater than the size of that segment.
This means that a memory segment still persists in the system. If your process is no longer running, run the ipcs command and remove the segment with ipcrm.
[root@myhost]# ipcs
------...
Popular Posts
-
The man page says: EINVAL A new segment was to be created and size < SHMMIN or size > SHMMAX, or no new segment was to be created, ...
-
To swap column 2 and 3 in a 4 column file: awk -F, '{print $1,$3,$2,$4}' OFS=; " FILE " > NEW_FILE where: OFS: ind...
-
Write the web service's response(xml, json, plain text) in a file, and then run the following in a terminal: $ while true; do echo -e...
-
If you want to delete a single route from the route table, you have to specify enough parameters to make this route unique. For example, t...
-
ENOSPC returns from msgget indicates that the system-wide maximum number of message queues has been reached. Solution: Change this lim...
-
To uninstall driver from unixODBC using odbcinst, execute: $ sudo odbcinst -u -d -n [ Driver_name ] FreeTDS has been deleted (if it existed...
-
Designed by Freepik You have a group of files and some of them are compressed with zip or gz and you want to search for a specific tex...
-
Shorcuts Ctrl + W - Erase one word in the current line. !! - Repeats the last command. Ctrl + Z - Stops the current command, Ctr...
-
The history command can be used to list all the previous commands you have typed before. The syntax is as following: history n where n ...
-
To erase files older than 24 hours ago: find . -mmin +1440 -exec rm -fr {} \ 24 hours = 24 * 60 minutes = 1440 minutes
Recent Posts
Categories
.bash
.bashrc
action
awk
bash
branch
changes
chmod
chown
color
column
command line
commands
commit
compress
compress files
compressed
config
console
convert
copy
CR-LF
create
cut
delete
desktop
diff
directories
directory
dos
driver
erase
error
etc
except
exclude
extract files
fetch
find
format
git
gnome
gz
hash
hostname
init.d
install
integrity
ipc
kernel
linux
list
ls
md5
mock
msgget
mysql
netcat
networking
newlines
odbc
odbcinst
openvpn
owner
passwd
paste
permissions
queue
quick guide
rc.d
readline
reboot
recursively
redhat
release
remove
rm
route
routing
scp
screen
script
selinux
shell
shmget
shortcuts
shutdown
SIOCDELRT
start
stderr
stdout
sublime text
sublime text 3
swap
sysctl
tail
tar
tar.gz
tcp
tcpdump
tee
terminal
test
truncate
udp
uname
uninstall
unixODBC
user
useradd
version
view
vpn
webservice
zgrep
zip
Unordered List
Text Widget
Pages
About Me
Search This Blog
Powered by Blogger.